diff options
author | unknown <bell@sanja.is.com.ua> | 2002-09-03 10:06:10 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2002-09-03 10:06:10 +0300 |
commit | 9dea4a4cd1ac246004dc9d223cfc606a7dea5567 (patch) | |
tree | 47d958e5060fcfc773f2874d7abccdd221a738cf /mysql-test | |
parent | 3a9dabd6765e7dad0cbd6949ac275487f72696d2 (diff) | |
parent | 3fbcafea9c5e85dc6315f0b89872ac5e273195c8 (diff) | |
download | mariadb-git-9dea4a4cd1ac246004dc9d223cfc606a7dea5567.tar.gz |
merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_subselect.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/distinct.result | 3 | ||||
-rw-r--r-- | mysql-test/r/subselect.result | 21 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 13 |
3 files changed, 31 insertions, 6 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index e347a95b037..89f4a8ae7f2 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -92,7 +92,8 @@ NULL NULL NULL 0 0 select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp; grp count(*) -0 7 +NULL 1 +0 6 1 6 SELECT DISTINCT FACILITY FROM t1; FACILITY diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index fb91bebd727..dada87803ad 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,7 +1,7 @@ select (select 2); (select 2) 2 -drop table if exists t1,t2,t3,t4,attend,clinic; +drop table if exists t1,t2,t3,t4,t5,attend,clinic; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -82,6 +82,23 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b); b ma 7 12 +create table t5 (a int); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +NULL 1 +2 2 +insert into t5 values (5); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +NULL 1 +2 2 +insert into t5 values (2); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a +NULL 1 +2 2 +select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; +Subselect return more than 1 record create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table clinic( uq int primary key, name char(25)); insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta"); @@ -91,4 +108,4 @@ patient_uq clinic_uq 1 1 1 2 2 2 -drop table t1,t2,t3,t4,attend,clinic; +drop table t1,t2,t3,t4,t5,attend,clinic; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 16ba6c9e602..8b9ed3b89c9 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,6 +1,6 @@ select (select 2); -drop table if exists t1,t2,t3,t4,attend,clinic; +drop table if exists t1,t2,t3,t4,t5,attend,clinic; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -33,11 +33,18 @@ select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b); select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b); - +create table t5 (a int); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +insert into t5 values (5); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +insert into t5 values (2); +select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; +-- error 1230 +select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table clinic( uq int primary key, name char(25)); insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta"); insert into attend values (1,1),(1,2),(2,2),(1,3); select * from attend where exists (select * from clinic where uq = clinic_uq); -drop table t1,t2,t3,t4,attend,clinic; +drop table t1,t2,t3,t4,t5,attend,clinic; |