ClickHouse/dbms/tests/queries/0_stateless/00863_comma_join_in.sql
2019-06-03 20:36:27 +03:00

22 lines
916 B
SQL

drop table if exists test1_00863;
drop table if exists test2_00863;
drop table if exists test3_00863;
create table test1_00863 (id UInt64, code String) engine = Memory;
create table test3_00863 (id UInt64, code String) engine = Memory;
create table test2_00863 (id UInt64, code String, test1_id UInt64, test3_id UInt64) engine = Memory;
insert into test1_00863 (id, code) select number, toString(number) FROM numbers(100000);
insert into test3_00863 (id, code) select number, toString(number) FROM numbers(100000);
insert into test2_00863 (id, code, test1_id, test3_id) select number, toString(number), number, number FROM numbers(100000);
select test2_00863.id
from test1_00863, test2_00863, test3_00863
where test1_00863.code in ('1', '2', '3')
and test2_00863.test1_id = test1_00863.id
and test2_00863.test3_id = test3_00863.id;
drop table test1_00863;
drop table test2_00863;
drop table test3_00863;