mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-07 15:02:08 +00:00
44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
-- { echoOn }
|
|
|
|
SELECT id, value FROM test_table WHERE 1 IN (SELECT 1);
|
|
0 Value_0
|
|
1 Value_1
|
|
2 Value_2
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE 0 IN (SELECT 1);
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE id IN (SELECT 1);
|
|
1 Value_1
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE id IN (SELECT 2);
|
|
2 Value_2
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE id IN test_table_for_in;
|
|
0 Value_0
|
|
1 Value_1
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE id IN (SELECT id FROM test_table_for_in);
|
|
0 Value_0
|
|
1 Value_1
|
|
SELECT '--';
|
|
--
|
|
SELECT id, value FROM test_table WHERE id IN (SELECT id FROM test_table_for_in UNION DISTINCT SELECT id FROM test_table_for_in);
|
|
0 Value_0
|
|
1 Value_1
|
|
SELECT '--';
|
|
--
|
|
WITH cte_test_table_for_in AS (SELECT id FROM test_table_for_in) SELECT id, value FROM test_table WHERE id IN cte_test_table_for_in;
|
|
0 Value_0
|
|
1 Value_1
|
|
SELECT '--';
|
|
--
|
|
WITH cte_test_table_for_in AS (SELECT id FROM test_table_for_in) SELECT id, value
|
|
FROM test_table WHERE id IN (SELECT id FROM cte_test_table_for_in UNION DISTINCT SELECT id FROM cte_test_table_for_in);
|
|
0 Value_0
|
|
1 Value_1
|