Available in versions: Dev (3.17) | Latest (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, H2, HANA, HSQLDB, INFORMIX, MARIADB, POSTGRES, 
-- SQLDATAWAREHOUSE, SQLITE, SQLSERVER, SYBASE, TERADATA, VERTICA, YUGABYTEDB
min(BOOK.ID)

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

(These are currently generated with jOOQ 3.17, 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