我希望在SELECT查询中创建带有别名的视图。在尝试使用这个语法之后,它就不是工作了。Clickhouse不支持视图查询中的别名,还是我的语法不好?
错误消息:
从服务器收到异常(20.3.5版):代码: 352。DB::Exception:从本地主机接收:9000。异常:无法检测左键和右键。联接部分模棱两可..
如果我在JOIN中删除别名(在A.column1 = B.column1 --> ON table_a.column1 =table_b.column1)中出现错误消息:
从服务器收到异常(20.3.5版):代码: 47。DB::Exception:从本地主机接收:9000。DB::Exception:缺失列:
创建表:
CREATE TABLE IF NOT EXISTS table_a
(
`column1` Nullable(Int32),
`column2` Nullable(Int32),
`column3` Nullable(Int32),
`column4` Nullable(Int32)
)
ENGINE = MergeTree()
PARTITION BY tuple()
order by tuple();
CREATE TABLE IF NOT EXISTS table_b
(
`column1` Nullable(Int32),
`column2` Nullable(Int32),
`column3` Nullable(Int32),
`column4` Nullable(Int32)
)
ENGINE = MergeTree()
PARTITION BY tuple()
order by tuple();
视图查询:
CREATE VIEW IF NOT EXISTS view_table_AB AS
SELECT
A.column1,
A.column2,
A.column3,
A.column4,
B.column1,
B.column2,
B.column3,
B.column4
FROM table_a AS A
INNER JOIN table_b AS B ON A.column1 = B.column1;
医生点击:别名
谢谢你的帮助
发布于 2020-05-18 09:48:36
看上去是窃听器。我添加了总刊11000,让我们等待答案。
作为解决办法,需要指定数据库前缀而不是别名:
CREATE VIEW IF NOT EXISTS view_table_AB AS
SELECT
table_a.column1,
table_a.column2,
table_a.column3,
table_a.column4,
table_b.column1,
table_b.column2,
table_b.column3,
table_b.column4
FROM table_a
INNER JOIN table_b ON table_a.column1 = table_b.column1;
https://stackoverflow.com/questions/61865368
复制相似问题