select SUM([price]) from (select * from table1 union all select * from table2) a最后加一个a表示什么意思?
------解决方案--------------------
起别名的,不加会报错的
------解决方案--------------------
select SUM(a.[price]) from (select * from table1 union all select * from table2) as a
取的别名。。顶楼上
------解决方案--------------------
(select * from table1 union all select * from table2) 结果的别名
------解决方案--------------------

------解决方案--------------------
from后面的这部分(select * from table1 union all select * from table2) ,
是一个派生表,由:
select * from table1
union all
select * from table2
组成的数据,而派生表必须要取个别名,不加就会报错。