不必要的ORDER BY表达式
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
当一个表达式在 ORDER BY 子句 中重复时,第二个表达式可以被移除,因为它没有效果 - 即使它对 ASC
、DESC
、NULLS
有不同的值。
使用 Settings.transformPatternsUnnecessaryOrderByExpressions
,可以实现以下转换
-- 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;
反馈
您对此页面有任何反馈吗?我们很乐意听到您的意见!