码迷,mamicode.com
首页 > 其他好文 > 详细

union all 简单用法

时间:2015-05-12 18:26:58      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

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

union all 简单用法

标签:

原文地址:http://www.cnblogs.com/chengjun/p/4498074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!