Commit 16f2e3d7 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

new test added

test fixed
parent 4714f690
...@@ -85,6 +85,10 @@ a b ...@@ -85,6 +85,10 @@ a b
2 b 2 b
3 c 3 c
3 c 3 c
select * from (select * from t1 union all select * from t1 limit 2) a;
a b
1 a
2 b
explain select * from (select * from t1 union select * from t1) a; explain select * from (select * from t1 union select * from t1) a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
...@@ -258,17 +262,13 @@ ID int(11) default NULL, ...@@ -258,17 +262,13 @@ ID int(11) default NULL,
PARID int(11) default NULL, PARID int(11) default NULL,
UNIQUE KEY t2_ID_IDX (ID), UNIQUE KEY t2_ID_IDX (ID),
KEY t2_PARID_IDX (PARID) KEY t2_PARID_IDX (PARID)
) TYPE=MyISAM DEFAULT CHARSET=latin1; ) engine=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2); INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
CREATE TABLE t3 ( CREATE TABLE t3 (
ID int(11) default NULL, ID int(11) default NULL,
DATA decimal(10,2) default NULL, DATA decimal(10,2) default NULL,
UNIQUE KEY t3_ID_IDX (ID) UNIQUE KEY t3_ID_IDX (ID)
) TYPE=MyISAM DEFAULT CHARSET=latin1; ) engine=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75); INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP; select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
497 ID NULL 497 ID NULL
......
...@@ -35,6 +35,7 @@ select a from (select 1 as a) as b; ...@@ -35,6 +35,7 @@ select a from (select 1 as a) as b;
select 1 from (select 1) as a; select 1 from (select 1) as a;
select * from (select * from t1 union select * from t1) a; select * from (select * from t1 union select * from t1) a;
select * from (select * from t1 union all select * from t1) a; select * from (select * from t1 union all select * from t1) a;
select * from (select * from t1 union all select * from t1 limit 2) a;
explain select * from (select * from t1 union select * from t1) a; explain select * from (select * from t1 union select * from t1) a;
explain select * from (select * from t1 union all select * from t1) a; explain select * from (select * from t1 union all select * from t1) a;
CREATE TABLE t2 (a int not null); CREATE TABLE t2 (a int not null);
...@@ -154,13 +155,13 @@ CREATE TABLE t2 ( ...@@ -154,13 +155,13 @@ CREATE TABLE t2 (
PARID int(11) default NULL, PARID int(11) default NULL,
UNIQUE KEY t2_ID_IDX (ID), UNIQUE KEY t2_ID_IDX (ID),
KEY t2_PARID_IDX (PARID) KEY t2_PARID_IDX (PARID)
) TYPE=MyISAM DEFAULT CHARSET=latin1; ) engine=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2); INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
CREATE TABLE t3 ( CREATE TABLE t3 (
ID int(11) default NULL, ID int(11) default NULL,
DATA decimal(10,2) default NULL, DATA decimal(10,2) default NULL,
UNIQUE KEY t3_ID_IDX (ID) UNIQUE KEY t3_ID_IDX (ID)
) TYPE=MyISAM DEFAULT CHARSET=latin1; ) engine=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75); INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP; select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
drop table t1, t2, t3; drop table t1, t2, t3;
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