Skip to main content
Returns a single arbitrary value from the specified column.

Syntax

Parameters

This function ignores NULL inputs. It returns NULL only when all inputs are NULL or there are no inputs.

Return Type

Same as input type

Examples

When multiple non-NULL values are present, ANY_VALUE returns one of them. The result is non-deterministic — different executions may return different values, but NULL is never returned while non-NULL values exist:

Rows: 1Execution time: 9.08ms

ANY_VALUE returns NULL when all inputs are NULL:

Rows: 1Execution time: 8.76ms

ANY_VALUE also returns NULL when no rows are available (for example, when filtered by a WHERE clause that matches nothing):

Rows: 1Execution time: 6.00ms