ANY_VALUE
Descriptionβ
Returns any value from the expression or column in the group. If there is a non-NULL value, it returns any non-NULL value; otherwise, it returns NULL.
Aliasβ
- ANY
Syntaxβ
ANY_VALUE(<expr>)
Parametersβ
Parameter | Description |
---|---|
<expr> | The column or expression to be aggregated. |
Return Valueβ
Returns any non-NULL value if a non-NULL value exists, otherwise returns NULL.
Exampleβ
select id, any_value(name) from cost2 group by id;
+------+-------------------+
| id | any_value(`name`) |
+------+-------------------+
| 3 | jack |
| 2 | jack |
+------+-------------------+