MIN

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram           .-ALL------.
>>-MIN--(--+----------+--expression--)-------------------------><
           '-DISTINCT-'
 

The MIN aggregate function returns the minimum value in a set of values in a group.

expression
The argument values can be any built-in data types other than a DataLink value.

The data type and length attribute of the result are the same as the data type and length attribute of the argument values. When the argument is a string, the result has the same CCSID as the argument. The result can be null.

If a sort sequence other than *HEX is in effect when the statement that contains the MIN function is executed and the arguments are SBCS data, mixed data, or Unicode data, then the result is obtained by comparing weighted values for each value in the set.

The function is applied to the set of values derived from the argument values by the elimination of null values.

If the function is applied to the empty set, the result is a null value. Otherwise, the result is the minimum value in the set.

The specification of DISTINCT has no effect on the result and is not advised.

Examples