- Categories:
GREATEST_ IGNORE_ NULLS¶
Returns the largest non-NULL value from a list of expressions. GREATEST_IGNORE_NULLS supports all data types, including VARIANT.
- See also:
Syntax¶
Arguments¶
<exprN>The arguments must include at least one expression. All the expressions should be of the same type or compatible types.
Returns¶
The first argument determines the return type:
- If the first type is numeric, then the return type is ‘widened’ according to the numeric types in the list of all arguments.
- If the first type is not numeric, then all other arguments must be convertible to the first type.
If all arguments are NULL, returns NULL.
Collation details¶
- The [collation specifications](#label-collation_specification) of all input arguments must be compatible.
- The comparisons follow the collation based on the input arguments’’ collations and precedences.
- The collation of the result of the function is the highest-[precedence](#label-determining-the-collation-used-in-an-operation) collation of the inputs.
Examples¶
Create a table and insert some values:
Run a SELECT statement that returns the greatest non-null value in each row of the table: