mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
This commit is contained in:
parent
18402c6191
commit
478cabee22
@ -0,0 +1 @@
|
||||
123456789 111 222
|
14
tests/queries/0_stateless/03041_analyzer_gigachad_join.sql
Normal file
14
tests/queries/0_stateless/03041_analyzer_gigachad_join.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE TABLE IF NOT EXISTS first engine = MergeTree PARTITION BY (inn, toYYYYMM(received)) ORDER BY (inn, sessionId)
|
||||
AS SELECT now() AS received, '123456789' AS inn, '42' AS sessionId;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS second engine = MergeTree PARTITION BY (inn, toYYYYMM(received)) ORDER BY (inn, sessionId)
|
||||
AS SELECT now() AS received, '123456789' AS inn, '42' AS sessionId, '111' AS serial, '222' AS reg;
|
||||
|
||||
SELECT alias_first.inn, arrayFirst(t -> isNotNull(t), regInfo.1), arrayFirst(t -> isNotNull(t), regInfo.2)
|
||||
FROM first AS alias_first
|
||||
INNER JOIN (
|
||||
SELECT alias_second.inn, alias_second.sessionId, groupArray((serial, reg)) AS regInfo
|
||||
FROM second AS alias_second
|
||||
GROUP BY inn, sessionId
|
||||
) AS resp ON (alias_first.inn = resp.inn) AND (alias_first.sessionId = resp.sessionId)
|
||||
WHERE if('123456789' IS NOT NULL, alias_first.inn = '123456789', 1)
|
Loading…
Reference in New Issue
Block a user