ANY_VALUE
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The ANY_VALUE()
aggregate function produces any random value from the group, non-deterministically
SELECT any_value(ID) FROM BOOK
create.select(anyValue(BOOK.ID)) .from(BOOK)
Producing (for example):
+-----------+ | any_value | +-----------+ | 3 | +-----------+
Dialect support
This example using jOOQ:
anyValue(BOOK.ID)
Translates to the following dialect specific expressions:
ASE, Access, Aurora Postgres, CockroachDB, DB2, Derby, Exasol, Firebird, HSQLDB, Hana, Informix, MariaDB, Postgres, SQLDataWarehouse, SQLServer, SQLite, Sybase, Teradata, Vertica, YugabyteDB
min(BOOK.ID)
Aurora MySQL, BigQuery, DuckDB, H2, MemSQL, MySQL, Oracle, Redshift, Snowflake
any_value(BOOK.ID)
ClickHouse
any(BOOK.ID)
Trino
arbitrary(BOOK.ID)
Generated with jOOQ 3.20. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!