MySQL附近的MySQL语法错误

时间:2016-09-20 14:55:12

标签: mysql

我的SQL:

CREATE TABLE merged AS
SELECT * FROM usmanpostaddress2
UNION SELECT FROM usman_post_address0 
UNION SELECT FROM usman_post_address1 
UNION SELECT FROM usman_post_address3
UNION SELECT FROM usman_post_address4 

给我这个错误:

  

1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在'from usmanpostaddress2'附近使用正确的语法UNION select from usman_post_address0 UNION select'在第2行

1 个答案:

答案 0 :(得分:0)

您缺少要从表中选择的列名。您的SELECT声明应为

create table MERGED 
as 
select * from usmanpostaddress2 
UNION 
select * from usman_post_address0 
UNION 
select * from usman_post_address1 
UNION 
select * from usman_post_address3 
UNION 
select * from usman_post_address4