2024-01-15 17:15:15 +00:00
|
|
|
SET output_format_pretty_color = 1;
|
2023-02-19 20:14:22 +00:00
|
|
|
SET allow_experimental_analyzer = 1;
|
|
|
|
|
2020-04-01 14:21:37 +00:00
|
|
|
DROP TABLE IF EXISTS table1;
|
|
|
|
DROP TABLE IF EXISTS table2;
|
2019-02-01 12:50:51 +00:00
|
|
|
|
2020-04-01 14:21:37 +00:00
|
|
|
CREATE TABLE table1(a String, b Date) ENGINE MergeTree order by a;
|
|
|
|
CREATE TABLE table2(c String, a String, d Date) ENGINE MergeTree order by c;
|
2019-02-01 12:50:51 +00:00
|
|
|
|
2020-04-01 14:21:37 +00:00
|
|
|
INSERT INTO table1 VALUES ('a', '2018-01-01') ('b', '2018-01-01') ('c', '2018-01-01');
|
|
|
|
INSERT INTO table2 VALUES ('D', 'd', '2018-01-01') ('B', 'b', '2018-01-01') ('C', 'c', '2018-01-01');
|
2019-02-01 12:50:51 +00:00
|
|
|
|
2020-04-01 14:21:37 +00:00
|
|
|
SELECT * FROM table1 t1 FORMAT PrettyCompact;
|
|
|
|
SELECT *, c as a, d as b FROM table2 FORMAT PrettyCompact;
|
2022-01-31 22:25:35 +00:00
|
|
|
SELECT * FROM table1 t1 ALL LEFT JOIN (SELECT *, c, d as b FROM table2) t2 USING (a, b) ORDER BY d, t1.a FORMAT PrettyCompact;
|
|
|
|
SELECT * FROM table1 t1 ALL INNER JOIN (SELECT *, c, d as b FROM table2) t2 USING (a, b) ORDER BY d, t1.a FORMAT PrettyCompact;
|
2019-02-01 12:50:51 +00:00
|
|
|
|
2020-04-01 14:21:37 +00:00
|
|
|
DROP TABLE table1;
|
|
|
|
DROP TABLE table2;
|