max

max — aggregate function to return the maximum of a range of values.

SYNOPSIS

max (expr)

DESCRIPTION

This function computes a value for each record returned by the query predicate, and returns the maximum non-null value determined using the greater-than relational operation appropriate for the data type of the specified values. The effect of relational operators on each LiveView data type are the same as those for StreamBase expression language data types, as described in StreamBase Data Types. The returned value is the same type as the argument.

EXAMPLE

This example shows how to use dynamic aggregation to find the maximum of the values in a column. In the Hello LiveView sample, create a query that finds the largest value of the lastSoldPrice field from the ItemSales table, grouping by Item. Follow these steps:

  1. In LiveView Desktop connected to a server running the Hello LiveView sample, select the ItemsSales table from the Tables pane of the LiveView Tables view.

  2. In the Select field, enter:

    Item, max(lastSoldPrice) AS maxLastSoldPrice
    
  3. In the Query field, enter the following:

    group by Item
    
  4. Click Open Query.

The query results open in a grid view. LiveView Server recalculates the maximum value whenever the rows returned by the query predicate change.

SEE ALSO

This LiveView aggregate function is based on the max aggregate function in the StreamBase expression language.