适用于以下版本: Dev (3.21) | 最新版 (3.20) | 3.19 | 3.18

不必要的GROUP BY表达式

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

当一个普通的 grouping set 表达式在 GROUP BY 子句 中重复出现时(即不是 ROLLUP、CUBE 或 GROUPING SETS),其中一个表达式可以被移除,因为它不起任何作用。

使用 Settings.transformPatternsUnnecessaryGroupByExpressions,可以实现以下转换

-- With Settings.transformPatternsUnnecessaryGroupByExpressions active, this:
SELECT a, b, count(*) FROM t GROUP BY a, b, a;

-- ... is transformed into the equivalent expression:
SELECT a, b, count(*) FROM t GROUP BY a, b;

反馈

您对此页面有任何反馈吗? 我们很乐意听取您的意见!

The jOOQ Logo