- Index

< Previous |  | Next >

## min

min — aggregate function to return the minimum of a range of numeric values.

## SYNOPSIS

`min (`expr`)`

## DESCRIPTION

This function computes a value for each record returned by the query predicate, and returns the minimum 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 minimum of the values in a column. In the Hello LiveView sample, create a query that finds the smallest 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, min(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 minimum value whenever the rows returned by the query predicate change.

## SEE ALSO

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