mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 03:12:43 +00:00
15 lines
1008 B
Markdown
15 lines
1008 B
Markdown
---
|
||
slug: /en/sql-reference/aggregate-functions/reference/any
|
||
sidebar_position: 6
|
||
---
|
||
|
||
# any
|
||
|
||
Selects the first encountered (non-NULL) value, unless all rows have NULL values in that column.
|
||
The query can be executed in any order and even in a different order each time, so the result of this function is indeterminate.
|
||
To get a determinate result, you can use the ‘min’ or ‘max’ function instead of ‘any’.
|
||
|
||
In some cases, you can rely on the order of execution. This applies to cases when SELECT comes from a subquery that uses ORDER BY.
|
||
|
||
When a `SELECT` query has the `GROUP BY` clause or at least one aggregate function, ClickHouse (in contrast to MySQL) requires that all expressions in the `SELECT`, `HAVING`, and `ORDER BY` clauses be calculated from keys or from aggregate functions. In other words, each column selected from the table must be used either in keys or inside aggregate functions. To get behavior like in MySQL, you can put the other columns in the `any` aggregate function.
|