select a1,sum(a2) a2 from(select a1,a2 from db1..table1 union all select a1,a2 from db2..table1 union all select a1,a2 from db3..table1) temp1 group by a1
select a1 ,sum(a2)
from
(select a1 ,a2 from db1.dbo.table1
union
select a1 ,a2 from db2.dbo.table1
union
select a1 ,a2 from db3.dbo.table1
) as T
group by a1