MIN and MAX Group Functions

A SELECT statement can include any of a number of SQL aggregate functions. The MIN and MAX functions are two functions supported by AcuSQL. The MIN function returns the minimum value of the column from all the rows in a table; the MAX function returns the maximum value.

Syntax

The field name to which the function applies must follow the name of the function and must be enclosed in parentheses.

SELECT MIN(fieldname)
SELECT MAX(fieldname)

Example

The select1.sqb program specifies records containing a customer number. This field is called c-number.

Given that this field contains a range of numbers, if you want to find the smallest value in the range, use the following SELECT statement:

SELECT MIN(C_NUMBER)

Similarly, to find the highest value in the range, use the following SELECT statement:

SELECT MAX(C_NUMBER)