diff options
author | unknown <bell@sanja.is.com.ua> | 2004-11-17 10:59:04 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-11-17 10:59:04 +0200 |
commit | dcd6e3d070abf96d9d2bf69bd42ff668059e8e83 (patch) | |
tree | 2d6572e4bc19b9976c2e7c80763f6c9053516018 /mysql-test | |
parent | 3a301ac1f8466eee0941344729a9ba3521da36a7 (diff) | |
parent | 70ed3160d97d66da74ab031dde64217d501abd6e (diff) | |
download | mariadb-git-dcd6e3d070abf96d9d2bf69bd42ff668059e8e83.tar.gz |
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-global-4.1
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/subselect.result | 21 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 27 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 32d482f5a32..f3c4be847ea 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1990,3 +1990,24 @@ ac 700 NULL drop tables t1,t2; +set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ; +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5); +insert into t2 values (1,3),(2,1); +select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b; +a b (select max(b) from t2 where t1.b=t2.a) +1 1 3 +1 2 1 +1 3 NULL +2 4 NULL +2 5 NULL +drop table t1, t2; +create table t1 (id int); +create table t2 (id int, body text, fulltext (body)); +insert into t1 values(1),(2),(3); +insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test'); +select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode)); +count(distinct id) +1 +drop table t2,t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e0f6fcbf515..18f7d96b236 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1282,3 +1282,30 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,' SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; drop tables t1,t2; + +# +# Subselect in non-select command just after connection +# +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connection root; +set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ; + +# +# primary query with temporary table and subquery with groupping +# +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5); +insert into t2 values (1,3),(2,1); +select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b; +drop table t1, t2; + +# +# subqueries with full text search +# +create table t1 (id int); +create table t2 (id int, body text, fulltext (body)); +insert into t1 values(1),(2),(3); +insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test'); +select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode)); +drop table t2,t1; |