The MIN aggregate function returns the minimum value in a set of values in a group.
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.
SELECT MAX(COMM) - MIN(COMM) INTO :COMM_SPREAD FROM EMPLOYEE WHERE WORKDEPT = 'D11'Results in COMM_SPREAD being set to 1118 (that is, 2580 - 1462).
SELECT MIN(PRENDATE) INTO :FIRST_FINISHED FROM PROJECTResults in FIRST_FINISHED being set to '1982-09-15'.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.