mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
subselect with union
new error handling Item_ref bug fixed
This commit is contained in:
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
select (select 2);
|
||||
(select 2)
|
||||
2
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
drop table if exists t1,t2,t3,t4,t5;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int);
|
||||
@ -82,4 +82,21 @@ 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
|
||||
drop table t1,t2,t3,t4;
|
||||
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
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
select (select 2);
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
drop table if exists t1,t2,t3,t4,t5;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int);
|
||||
@ -33,4 +33,12 @@ 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);
|
||||
drop table t1,t2,t3,t4;
|
||||
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;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
Reference in New Issue
Block a user