日期:2014-05-17 浏览次数:20708 次
select 列a,sum(列b) '列b'
from [表名]
group by 列a
create table #T(
a int null,
b int null
)
insert into #T
select 101,5 union all
select 102,7 union all
select 101,6 union all
select 102,8 union all
select 105,7
select A,SUM(b) from #T group by a
结果
A (无列名)
101 11
102 15
105 7