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/work-top3-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-simple_in-4.1
This commit is contained in:
@ -1270,3 +1270,15 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 10 Using where
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int, b int);
|
||||
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
|
||||
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
|
||||
insert into t3 values (3,3), (2,2), (1,1);
|
||||
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
|
||||
a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
|
||||
3 1
|
||||
2 2
|
||||
1 2
|
||||
drop table t1,t2,t3;
|
||||
|
@ -844,3 +844,14 @@ explain select * from t2 where t2.a in (select a from t1);
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
explain select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# alloc_group_fields() working
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int, b int);
|
||||
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
|
||||
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
|
||||
insert into t3 values (3,3), (2,2), (1,1);
|
||||
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
|
||||
drop table t1,t2,t3;s
|
||||
|
Reference in New Issue
Block a user