summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2005-01-21 14:54:27 +0200
committerbell@sanja.is.com.ua <>2005-01-21 14:54:27 +0200
commit938acb329193044b5a6f5df32c422eab384ecb83 (patch)
tree8ddcdf5e633f1f2c76637463fa506879e69bef72 /mysql-test
parente0df86cd357e92215ac78c5563d1cafd217fae9a (diff)
parent3bd203d3f618659ca448a783bfa1b2f6d43b2bc0 (diff)
downloadmariadb-git-938acb329193044b5a6f5df32c422eab384ecb83.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/derived.result9
-rw-r--r--mysql-test/t/derived.test10
2 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 7e6b9b44566..61d745d0236 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -330,3 +330,12 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg
10.00 10.00 10
DROP TABLE t1;
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+sum(b)
+4
+select distinct sum(b) from (select a,b from t1) y group by a;
+sum(b)
+4
+drop table t1;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 64e3fe8929b..8b322746ed6 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -214,3 +214,13 @@ CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) N
insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
DROP TABLE t1;
+
+#
+# DISTINCT over grouped select on subquery in the FROM clause
+#
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+select distinct sum(b) from (select a,b from t1) y group by a;
+drop table t1;
+