summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r--mysql-test/t/subselect.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index c9ed62f0e54..ed122e9ff5a 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1868,7 +1868,30 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
select * from t1 where (s1 = ALL (select s1/s1 from t1));
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
drop table t1;
-# End of 4.1 tests
+
+#
+# Bug #16255: Subquery in where
+#
+create table t1 (
+ retailerID varchar(8) NOT NULL,
+ statusID int(10) unsigned NOT NULL,
+ changed datetime NOT NULL,
+ UNIQUE KEY retailerID (retailerID, statusID, changed)
+);
+
+INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
+INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
+
+select * from t1 r1
+ where (r1.retailerID,(r1.changed)) in
+ (SELECT r2.retailerId,(max(changed)) from t1 r2
+ group by r2.retailerId);
+drop table t1;
+
# End of 4.1 tests
#