Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

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:

-- ACCESS, ASE, AURORA_POSTGRES, COCKROACHDB, DB2, DERBY, EXASOL, FIREBIRD, HANA, HSQLDB, INFORMIX, MARIADB, POSTGRES, 
-- SQLDATAWAREHOUSE, SQLITE, SQLSERVER, SYBASE, TERADATA, VERTICA, YUGABYTEDB
min(BOOK.ID)

-- AURORA_MYSQL, BIGQUERY, DUCKDB, H2, MEMSQL, MYSQL, ORACLE, REDSHIFT, SNOWFLAKE
any_value(BOOK.ID)

-- TRINO
arbitrary(BOOK.ID)

(These are currently generated with jOOQ 3.19, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo