This is experimental functionality, and as such subject to change. Use at your own risk!
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.
Unnecessary ORDER BY expressions
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
When an expression is repeated in the ORDER BY clause, then the second one can be removed as it has no effect - even if it has a different value for ASC
, DESC
, NULLS
.
Using Settings.transformPatternsUnnecessaryOrderByExpressions, the following transformations can be achieved:
-- With Settings.transformPatternsUnnecessaryOrderByExpressions active, this: SELECT a, b FROM t ORDER BY a DESC, b, a ASC; -- ... is transformed into the equivalent expression: SELECT a, b FROM t GROUP BY a DESC, b;
Feedback
Do you have any feedback about this page? We'd love to hear it!