提交 9fe0eceb authored 作者: Thomas Mueller's avatar Thomas Mueller

"group_concat(distinct ...)" did not work correctly in a view or subquery (the…

"group_concat(distinct ...)" did not work correctly in a view or subquery (the 'distinct' was lost). Example: select * from (select group_concat(distinct 1) from system_range(1, 3));
上级 8638d106
...@@ -462,6 +462,9 @@ public class Aggregate extends Expression { ...@@ -462,6 +462,9 @@ public class Aggregate extends Expression {
private String getSQLGroupConcat() { private String getSQLGroupConcat() {
StatementBuilder buff = new StatementBuilder("GROUP_CONCAT("); StatementBuilder buff = new StatementBuilder("GROUP_CONCAT(");
if (distinct) {
buff.append("DISTINCT ");
}
buff.append(on.getSQL()); buff.append(on.getSQL());
if (orderList != null) { if (orderList != null) {
buff.append(" ORDER BY "); buff.append(" ORDER BY ");
......
select * from (select group_concat(distinct 1) from system_range(1, 3));
> 1;
select sum(mod(x, 2) = 1) from system_range(1, 10); select sum(mod(x, 2) = 1) from system_range(1, 10);
> 5; > 5;
create table a(x int); create table a(x int);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论