Commit 848548e1 authored by sergefp@mysql.com's avatar sergefp@mysql.com

BUG#16255: Post-review fixes: adjust the testcase.

parent d4cacdb5
...@@ -2895,14 +2895,25 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); ...@@ -2895,14 +2895,25 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
s1 s1
2 2
drop table t1; drop table t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); create table t1 (
INSERT INTO t1 VALUES(26, 1), (48, 2); retailerID varchar(8) NOT NULL,
SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); statusID int(10) unsigned NOT NULL,
a b changed datetime NOT NULL,
26 1 UNIQUE KEY retailerID (retailerID, statusID, changed)
48 2 );
SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
a b INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
26 1 INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
48 2 INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
DROP TABLE t1; 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);
retailerID statusID changed
0026 2 2006-01-06 12:25:53
0037 2 2006-01-06 12:25:53
0048 1 2006-01-06 12:37:50
0059 1 2006-01-06 12:37:50
drop table t1;
...@@ -1865,12 +1865,24 @@ drop table t1; ...@@ -1865,12 +1865,24 @@ drop table t1;
# #
# Bug #16255: Subquery in where # Bug #16255: Subquery in where
# #
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)); create table t1 (
retailerID varchar(8) NOT NULL,
INSERT INTO t1 VALUES(26, 1), (48, 2); statusID int(10) unsigned NOT NULL,
changed datetime NOT NULL,
UNIQUE KEY retailerID (retailerID, statusID, changed)
);
SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a,MAX(b) FROM t1 GROUP BY a); INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
SELECT * FROM t1 r WHERE (r.a,r.b) IN (SELECT a + 0,MAX(b) FROM t1 GROUP BY a); 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;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
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