diff options
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r-- | mysql-test/r/group_by.result | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index f92b3ea4f4d..17b1bb03d1d 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -629,15 +629,6 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort DROP TABLE t1; -create table t1 ( col1 int, col2 int ); -insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2); -select group_concat( distinct col1 ) as alias from t1 -group by col2 having alias like '%'; -alias -1,2 -1,2 -1 -drop table t1; create table t1 (a int); insert into t1 values(null); select min(a) is null from t1; @@ -650,3 +641,39 @@ select 1 and min(a) is null from t1; 1 and min(a) is null 1 drop table t1; +create table t1 ( col1 int, col2 int ); +insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2); +select group_concat( distinct col1 ) as alias from t1 +group by col2 having alias like '%'; +alias +1,2 +1,2 +1 +drop table t1; +create table t1 (a integer, b integer, c integer); +insert into t1 (a,b) values (1,2),(1,3),(2,5); +select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; +a r2 r1 +1 1.0 2 +select a, rand()*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; +a r2 r1 +1 1 2 +select a,sum(b) from t1 where a=1 group by c; +a sum(b) +1 5 +select a*sum(b) from t1 where a=1 group by c; +a*sum(b) +5 +select sum(a)*sum(b) from t1 where a=1 group by c; +sum(a)*sum(b) +10 +select a,sum(b) from t1 where a=1 group by c having a=1; +a sum(b) +1 5 +select a as d,sum(b) from t1 where a=1 group by c having d=1; +d sum(b) +1 5 +select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0; +d +10 +drop table t1; |