2019-02-15 10:15:56 +00:00
|
|
|
-------No need for predicate optimization, but still works-------
|
2018-03-04 16:15:31 +00:00
|
|
|
1
|
|
|
|
1
|
|
|
|
1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2019-04-18 10:39:25 +00:00
|
|
|
-------Forbid push down-------
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT count()
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
[number] AS a,
|
|
|
|
[number * 2] AS b
|
|
|
|
FROM system.numbers
|
|
|
|
LIMIT 1
|
|
|
|
) AS t
|
2020-09-08 20:05:47 +00:00
|
|
|
ARRAY JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
|
|
|
WHERE NOT ignore(a + b)
|
2019-04-18 10:39:25 +00:00
|
|
|
1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS a
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
1 AS a,
|
|
|
|
1 AS b
|
|
|
|
) USING (a)
|
|
|
|
WHERE b = 0
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
1 AS a,
|
|
|
|
1 AS b
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY RIGHT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS a
|
|
|
|
) USING (a)
|
|
|
|
WHERE b = 0
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS a
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY FULL OUTER JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
1 AS a,
|
|
|
|
1 AS b
|
|
|
|
) USING (a)
|
|
|
|
WHERE b = 0
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
1 AS a,
|
|
|
|
1 AS b
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY FULL OUTER JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS a
|
|
|
|
) USING (a)
|
|
|
|
WHERE b = 0
|
2018-08-22 06:42:37 +00:00
|
|
|
-------Need push down-------
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT toString(value) AS value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS value
|
|
|
|
)
|
2019-02-15 10:15:56 +00:00
|
|
|
1
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT id
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT 1 AS id
|
|
|
|
UNION ALL
|
|
|
|
SELECT 2 AS `--predicate_optimizer_0`
|
|
|
|
WHERE 0
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-15 10:15:56 +00:00
|
|
|
1
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT id
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT arrayJoin([1, 2, 3]) AS id
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-15 10:15:56 +00:00
|
|
|
1
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT id
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT arrayJoin([1, 2, 3]) AS id
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-15 10:15:56 +00:00
|
|
|
1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
subquery
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
1 AS id,
|
2021-02-14 11:09:36 +00:00
|
|
|
identity(CAST(1, \'UInt8\')) AS subquery
|
2021-02-11 07:30:08 +00:00
|
|
|
WHERE subquery = 1
|
2020-06-22 14:37:42 +00:00
|
|
|
)
|
2020-12-23 19:36:10 +00:00
|
|
|
WHERE subquery = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
toUInt64(sum(id) AS b) AS a,
|
|
|
|
b
|
|
|
|
FROM test_00597
|
|
|
|
HAVING a = 3
|
|
|
|
)
|
|
|
|
WHERE a = 3
|
2019-02-20 12:36:46 +00:00
|
|
|
3 3
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
min(id) AS id
|
|
|
|
FROM test_00597
|
2020-09-08 20:05:47 +00:00
|
|
|
GROUP BY
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
HAVING id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
a,
|
|
|
|
b
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
toUInt64(sum(id) AS b) AS a,
|
|
|
|
b
|
|
|
|
FROM test_00597 AS table_alias
|
|
|
|
HAVING b = 3
|
|
|
|
) AS outer_table_alias
|
|
|
|
WHERE b = 3
|
2019-02-20 12:36:46 +00:00
|
|
|
3 3
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
) AS b
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
) AS b
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
) AS a
|
|
|
|
WHERE id = 1
|
|
|
|
) AS b
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
date,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
date,
|
|
|
|
min(value) AS value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
2020-09-08 20:05:47 +00:00
|
|
|
GROUP BY
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
date
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
1 2000-01-01 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
UNION ALL
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT id
|
|
|
|
FROM test_00597
|
|
|
|
) USING (id)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT toInt8(1) AS id
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
) AS test_00597 USING (id)
|
|
|
|
WHERE value = 1
|
2019-02-26 10:07:58 +00:00
|
|
|
1 2000-01-01 test string 1 1
|
2020-06-22 14:37:42 +00:00
|
|
|
SELECT value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT toInt8(1) AS id
|
|
|
|
)
|
|
|
|
ANY LEFT JOIN test_00597 AS b USING (id)
|
|
|
|
WHERE value = 1
|
2019-02-26 10:07:58 +00:00
|
|
|
1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
|
|
|
SELECT id
|
|
|
|
FROM test_00597
|
|
|
|
) USING (id)
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
b.date,
|
|
|
|
b.name,
|
|
|
|
b.value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
) AS b USING (id)
|
|
|
|
WHERE b.id = 1
|
2019-02-20 12:36:46 +00:00
|
|
|
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
id,
|
|
|
|
date,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
toInt8(1) AS id,
|
|
|
|
toDate(\'2000-01-01\') AS date
|
|
|
|
FROM system.numbers
|
|
|
|
LIMIT 1
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
) AS b USING (date, id)
|
|
|
|
WHERE b.date = toDate(\'2000-01-01\')
|
2019-02-20 12:36:46 +00:00
|
|
|
1 2000-01-01 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
`b.date`,
|
|
|
|
`b.id`,
|
|
|
|
`b.name`,
|
|
|
|
`b.value`
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
b.date,
|
|
|
|
b.id,
|
|
|
|
b.name,
|
|
|
|
b.value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
) AS a
|
2021-05-15 09:11:13 +00:00
|
|
|
ANY LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
) AS b ON id = b.id
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
2019-03-25 14:56:15 +00:00
|
|
|
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
r.date,
|
|
|
|
r.name,
|
|
|
|
r.value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
)
|
2021-05-15 09:11:13 +00:00
|
|
|
SEMI LEFT JOIN
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2020-06-22 14:37:42 +00:00
|
|
|
(
|
2020-09-08 20:05:47 +00:00
|
|
|
SELECT
|
2020-06-22 14:37:42 +00:00
|
|
|
date,
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
value
|
|
|
|
FROM test_00597
|
|
|
|
WHERE id = 1
|
|
|
|
)
|
|
|
|
WHERE id = 1
|
|
|
|
) AS r USING (id)
|
|
|
|
WHERE r.id = 1
|
2020-02-20 02:56:20 +00:00
|
|
|
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
|
2021-03-24 12:48:29 +00:00
|
|
|
SELECT value + t1.value AS expr
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2021-03-24 12:48:29 +00:00
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
value,
|
|
|
|
t1.value
|
|
|
|
FROM test_00597 AS t0
|
|
|
|
ALL FULL OUTER JOIN test_00597 AS t1 USING (date)
|
|
|
|
WHERE (value + `t1.value`) < 3
|
|
|
|
)
|
|
|
|
WHERE expr < 3
|
|
|
|
2
|