这是我的查询:
select * from (
select Name, Address
from table1
UNION ALL
select Name, Address
from table2
) D
执行此查询时出错:
为"D"多次指定了列"Name"。
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
试试这个
使用别名
select * from (
select t1.Name, t1.Address
from table1 as t1
UNION ALL
select t2.Name, t2.Address
from table2 as t2
) D