2017-04-06 21:44:52 +00:00
|
|
|
SET join_use_nulls = 0;
|
2019-08-08 14:20:25 +00:00
|
|
|
SET any_join_distinct_right_table_keys = 1;
|
2017-04-06 21:44:52 +00:00
|
|
|
|
|
|
|
SELECT k, a, b
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js1
|
2017-04-06 21:44:52 +00:00
|
|
|
ANY INNER JOIN
|
|
|
|
(
|
|
|
|
SELECT number AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js2 USING (k) ORDER BY k;
|
2017-04-06 21:44:52 +00:00
|
|
|
|
|
|
|
SELECT k, a, b
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT number AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js1
|
2017-04-06 21:44:52 +00:00
|
|
|
ANY LEFT JOIN
|
|
|
|
(
|
|
|
|
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js2 USING (k) ORDER BY k;
|
2017-04-06 21:44:52 +00:00
|
|
|
|
|
|
|
SELECT k, a, b
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js1
|
2017-04-06 21:44:52 +00:00
|
|
|
ANY RIGHT JOIN
|
|
|
|
(
|
|
|
|
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
2019-08-29 18:45:34 +00:00
|
|
|
) js2 USING (k) ORDER BY k;
|
2021-08-30 11:05:47 +00:00
|
|
|
|
|
|
|
SELECT k, b
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT number + 1 AS k FROM numbers(10)
|
|
|
|
) js1
|
|
|
|
RIGHT JOIN
|
|
|
|
(
|
|
|
|
SELECT nullIf(number, if(number % 2 == 0, number, 0)) AS k, number AS b FROM numbers(10)
|
|
|
|
) js2 USING (k) ORDER BY k, b;
|