select Y.ID,sum(cast(Y.m as int)) as he
from
(select top 10 a.ID,a.AlarmSource as m from dbo.AlarmInfo a
union all
select top 10 B.ID,B.AssetCode as m from dbo.AuxiliaryToolInfo B
)Y
group by Y.ID
select top 10 A.* from dbo.AlarmInfo A;
select top 10 B.* from dbo.AuxiliaryToolInfo B
select * from dbo.MES_DataRealtime