代码改变世界

sql server查询

2011-12-15 23:32  桂仙人  阅读(172)  评论(0)    收藏  举报

有一张这样的表:

实现这样的查询结果:

如下:

 

select Name,sum(case Score when N'胜' then 1 else 0 end )as 胜,
sum(case Score when N'负' then 1 else 0 end) as 负  from TableScore
group by Name