mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
This commit is contained in:
parent
cf8a83bb36
commit
d7827eaf57
43
tests/queries/0_stateless/03053_analyzer_join_alias.sql
Normal file
43
tests/queries/0_stateless/03053_analyzer_join_alias.sql
Normal file
@ -0,0 +1,43 @@
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/23104
|
||||
DROP DATABASE IF EXISTS test_03053;
|
||||
CREATE DATABASE test_03053;
|
||||
|
||||
CREATE TABLE test_03053.base
|
||||
(
|
||||
`id` UInt64,
|
||||
`id2` UInt64,
|
||||
`d` UInt64,
|
||||
`value` UInt64
|
||||
)
|
||||
ENGINE=MergeTree()
|
||||
PARTITION BY d
|
||||
ORDER BY (id,id2,d);
|
||||
|
||||
CREATE TABLE test_03053.derived1
|
||||
(
|
||||
`id1` UInt64,
|
||||
`d1` UInt64,
|
||||
`value1` UInt64
|
||||
)
|
||||
ENGINE = MergeTree()
|
||||
PARTITION BY d1
|
||||
ORDER BY (id1, d1);
|
||||
|
||||
CREATE TABLE test_03053.derived2
|
||||
(
|
||||
`id2` UInt64,
|
||||
`d2` UInt64,
|
||||
`value2` UInt64
|
||||
)
|
||||
ENGINE = MergeTree()
|
||||
PARTITION BY d2
|
||||
ORDER BY (id2, d2);
|
||||
|
||||
SELECT
|
||||
base.id AS `base.id`,
|
||||
derived2.id2 AS `derived2.id2`,
|
||||
derived2.value2 AS `derived2.value2`,
|
||||
derived1.value1 AS `derived1.value1`
|
||||
FROM test_03053.base AS base
|
||||
LEFT JOIN test_03053.derived2 AS derived2 ON base.id2 = derived2.id2
|
||||
LEFT JOIN test_03053.derived1 AS derived1 ON base.id = derived1.id1;
|
Loading…
Reference in New Issue
Block a user