[英]Union tables in Vertica SQL where tables have different order of columns?
I have 2 tables in Vertica SQL and how can I union all these tables to create tables as in result?我在 Vertica SQL 中有 2 个表,如何合并所有这些表以创建结果表? As you can see tables 1 and table 2 have different order of columns:
如您所见,表 1 和表 2 具有不同的列顺序:
Just list the columns in the order you want them:只需按您想要的顺序列出列:
select col1, col2, col3
from table1
union all
select col2, col1, null
from table2;
Use SELECT INTO and UNION ALL would solve your problem使用 SELECT INTO 和 UNION ALL 可以解决您的问题
SELECT * INTO TEMP TABLE RESULT FROM TABLE1
UNION ALL
SELECT * FROM TABLE2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.