mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
22 lines
916 B
SQL
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;
|