Commit 41eb4665 authored by unknown's avatar unknown

order by group_func

parent e6c780a5
...@@ -733,3 +733,10 @@ xxxxxxxxxxxxxxxxxxxaa ...@@ -733,3 +733,10 @@ xxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxz xxxxxxxxxxxxxxxxxxxz
drop table t1; drop table t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
a b
1 2
1 1
drop table t1;
...@@ -500,3 +500,9 @@ insert into t1 set a = concat(repeat('x', 19), 'aa'); ...@@ -500,3 +500,9 @@ insert into t1 set a = concat(repeat('x', 19), 'aa');
set max_sort_length=20; set max_sort_length=20;
select a from t1 order by a; select a from t1 order by a;
drop table t1; drop table t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
drop table t1;
...@@ -262,11 +262,13 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, ...@@ -262,11 +262,13 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
save_allow_sum_func= thd->allow_sum_func; save_allow_sum_func= thd->allow_sum_func;
thd->allow_sum_func= 0; thd->allow_sum_func= 0;
res= (setup_conds(thd, tables, conds) || res= setup_conds(thd, tables, conds);
setup_order(thd, ref_pointer_array, tables, fields, all_fields, thd->allow_sum_func= save_allow_sum_func;
order) || res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
setup_group(thd, ref_pointer_array, tables, fields, all_fields, order);
group, hidden_group_fields)); thd->allow_sum_func= 0;
res= res || setup_group(thd, ref_pointer_array, tables, fields, all_fields,
group, hidden_group_fields);
thd->allow_sum_func= save_allow_sum_func; thd->allow_sum_func= save_allow_sum_func;
DBUG_RETURN(res); DBUG_RETURN(res);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment