日期:2014-05-17 浏览次数:20679 次
declare @t table (W_anme varchar(2),w_sl int)
insert into @t
select 'aa',3 union all
select 'bb',6 union all
select 'cc',2 union all
select 'aa',1 union all
select 'bb',8 union all
select 'bb',5
select W_anme,sum(w_sl) w_sl from @t group by W_anme
/*
W_anme w_sl
------ -----------
aa 4
bb 19
cc 2
*/
select W_anme,sum(w_sl) w_sl from 你的表名 group by W_anme