MAX. -- Calculate the maximum value
The MAX. column function returns the greatest value in the group
of numbers or characters in a specified column. You can apply MAX. to
columns of any type.
If MAX. is applied to a CHAR or VARCHAR type column, alphanumeric
ordering is used.
- The number 9 is greater than 8, and so on, to 0 (zero).
- Zero is greater than the uppercase Z, which is greater than Y, and so
on, to A.
- A is greater than the lowercase z, which is greater than y, and so on,
to a.
- Lowercase a is greater than the special characters.
QMF ignores null values when searching for the maximum. If all values specified
in a column are null, QMF returns no value.
You can use an example element with MAX. to select the maximum
years of employment and maximum salary from the Q.STAFF table.
When you run this query:
Q.STAFF | YEARS | SALARY | | |
--------+-------+------------|------------+------------|
| _Y | _S | P. MAX. _Y | P. MAX. _S |
QMF produces this report:
MAX(YEARS) MAX(SALARY)
---------- -----------
13 22959.20
Rules for MAX.
- You can follow MAX. with an example element or an arithmetic
expression that contains at least one example element.
- In an unnamed column, you must specify MAX. with the example
element that identifies the column from which the largest value is to be retrieved.
This example element also appears in the column that contains the value to
retrieve.
- When you apply MAX. to a column named in an example table,
you must apply a column function (AVG., SUM., MIN., MAX., COUNT.),
or the G. (group) operator to every other column to select.
[ Previous Page | Next Page | Contents | Index ]