summaryrefslogtreecommitdiff
path: root/mysql-test/t/group_by.test
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-03-25 13:06:20 +0200
committerunknown <monty@narttu.mysql.fi>2003-03-25 13:06:20 +0200
commit829045100dc01e3cd3b4936d5c0aee8e02bbf894 (patch)
treea39705f60353e0c451cad26a7574e39ec9e786d0 /mysql-test/t/group_by.test
parent7517a59a6dac4580b1f7b5cf87abf6d75b096bbc (diff)
downloadmariadb-git-829045100dc01e3cd3b4936d5c0aee8e02bbf894.tar.gz
Fixed bug with GROUP BY and alias
mysql-test/r/group_by.result: Test for group by + alias bug mysql-test/t/group_by.test: Test for group by + alias bug
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r--mysql-test/t/group_by.test12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index ab5d6062daf..7988a529afa 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -417,3 +417,15 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
drop table t1;
+
+#
+# Problem with group by and alias
+#
+
+create table t1 (id int not null, qty int not null);
+insert into t1 values (1,2),(1,3),(2,4),(2,5);
+select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and cqty>1;
+select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
+select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
+select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
+drop table t1;