mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
39 lines
937 B
Plaintext
39 lines
937 B
Plaintext
|
-- { echoOn }
|
||
|
|
||
|
SELECT * FROM test1 LEFT JOIN test2 ON test1.col1 = test2.col1
|
||
|
WHERE test2.col1 IS NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
12321 -30 \N \N
|
||
|
SELECT * FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
||
|
WHERE test2.col1 IS NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
\N \N 12321 -30
|
||
|
SELECT * FROM test1 LEFT JOIN test2 ON test1.col1 = test2.col1
|
||
|
WHERE test2.col1 IS NOT NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
123 123 123 5600
|
||
|
321 -32 321 5601
|
||
|
SELECT * FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
||
|
WHERE test2.col1 IS NOT NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
123 5600 123 123
|
||
|
321 5601 321 -32
|
||
|
SELECT test2.col1, test1.* FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
||
|
WHERE test2.col1 IS NOT NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
123 123 123
|
||
|
321 321 -32
|
||
|
SELECT test2.col3, test1.* FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
||
|
WHERE test2.col1 IS NOT NULL
|
||
|
ORDER BY test2.col1
|
||
|
;
|
||
|
5600 123 123
|
||
|
5601 321 -32
|
||
|
DROP TABLE IF EXISTS test1;
|
||
|
DROP TABLE IF EXISTS test2;
|