2016-09-20 109 views
0

我的SQL:语法错误在MySQL附近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 

给了我这个错误:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from usmanpostaddress2 UNION select from usman_post_address0 UNION select ' at line 2

+0

请修复您的问题标题。错误消息不会将'UNION'语句标记为问题位置,而是'FROM'。 – arkascha

+0

原因可能是'SELECT FROM'是无效的SQL。 “SELECT _what_ FROM ...”? – arkascha

回答

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