mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-innodb-4.1 sql/item_subselect.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
@ -96,3 +96,13 @@ id value (select t1.value from t1 where t1.id=t2.id)
|
||||
1 z a
|
||||
2 x b
|
||||
drop table t1,t2;
|
||||
create table t1 (a int, b int) engine=innodb;
|
||||
insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
|
||||
create table t2 (a int) engine=innodb;
|
||||
insert into t2 values (1),(2),(3),(4);
|
||||
select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
|
||||
a b
|
||||
1 5
|
||||
2 12
|
||||
4 105
|
||||
drop table t1, t2;
|
||||
|
@ -101,3 +101,13 @@ insert into t2 values (1,'z'),(2,'x');
|
||||
select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
|
||||
select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# unlocking tables with subqueries in HAVING
|
||||
#
|
||||
create table t1 (a int, b int) engine=innodb;
|
||||
insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
|
||||
create table t2 (a int) engine=innodb;
|
||||
insert into t2 values (1),(2),(3),(4);
|
||||
select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
|
||||
drop table t1, t2;
|
||||
|
Reference in New Issue
Block a user