Available in versions: Dev (3.18)

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.

GROUP BY <column index>

Applies to ❌ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

A lot of dialects support GROUP BY <column index> where the (1 based) column index references a column from the SELECT clause (if it is an expression that does not contain an aggregate or window function).

This transformation allows for transforming some of these syntaxes to equivalent, standard syntax by repeating the expression:

-- Input
SELECT t.col FROM t GROUP BY 1
-- Output
SELECT t.col FROM t GROUP BY t.col

Example configuration

Settings settings = new Settings()
    .setTransformGroupByColumnIndex(Transformation.WHEN_NEEDED);

Feedback

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

The jOOQ Logo