declare @t table
(
id int identity(1,1),
UserId varchar(10),
Odds int
)
insert @t select 'a',12
union all select 'b',23
union all select 'c',34
select
isnull(userid,'total') as userid,
sum(odds) as odds
from @t
group by userid
with rollup
/**
userid odds
--------------
a 12
b 23
c 34
total 69
**/
大家帮我看看这段代码是什么意思啊!尤其是isnull和with rollup谢谢大家了!
翻翻过去那场雪
慕少森