Vertica 从连接重复键列创建视图
Vertica create view from join duplicate key columns
当我尝试通过连接在 Vertica 中创建视图时,
CREATE VIEW c AS
SELECT * FROM a JOIN b ON a.key = b.key;
我收到错误消息,因为键列重复:
ROLLBACK 5450: View definition can not contain duplicate column names "key"
在非 Vertica SQL 中,我知道当两个键列名称相同时我可以使用 USING
关键字,但 Vertica 没有 USING
[编辑:wij pointed out that Vertica SQL does have USING
]. I could also list out columns explicitly instead of selecting *
, but one of the tables has hundreds of columns and I want them all (except for the duplicate key). There also doesn't seem to be an easy way 到 select 除了一列。
当列名相同但没有 USING
时,有没有一种方法可以 select 连接中只有一个键列?
写入列的列表(因为两个表都有字段键),例如:
CREATE VIEW c AS
SELECT a.*, b.field1, b.field2 FROM a JOIN b ON a.key = b.key;
当我尝试通过连接在 Vertica 中创建视图时,
CREATE VIEW c AS
SELECT * FROM a JOIN b ON a.key = b.key;
我收到错误消息,因为键列重复:
ROLLBACK 5450: View definition can not contain duplicate column names "key"
在非 Vertica SQL 中,我知道当两个键列名称相同时我可以使用 USING
关键字,但 Vertica 没有 [编辑:wij pointed out that Vertica SQL does have USING
USING
]. I could also list out columns explicitly instead of selecting *
, but one of the tables has hundreds of columns and I want them all (except for the duplicate key). There also doesn't seem to be an easy way 到 select 除了一列。
当列名相同但没有 USING
时,有没有一种方法可以 select 连接中只有一个键列?
写入列的列表(因为两个表都有字段键),例如:
CREATE VIEW c AS
SELECT a.*, b.field1, b.field2 FROM a JOIN b ON a.key = b.key;