这是我的疑问:
select * from (
select Name, Address
from table1
UNION ALL
select Name, Address
from table2
) D
执行此查询时收到错误:
列'名称'被多次指定为' D'。
答案 0 :(得分:1)
使用别名
select * from (
select t1.Name, t1.Address
from table1 as t1
UNION ALL
select t2.Name, t2.Address
from table2 as t2
) D
答案 1 :(得分:1)
select * from (
select t1.Name as t1_Name, t1_Address as t1_Address
from table t1
UNION ALL
select t2.Name as t2_Name, t2_Address as t2_Address
from table t2
) D
试试这个