有一张这样的表:
实现这样的查询结果:
如下:
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
有一张这样的表:
实现这样的查询结果:
如下:
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
转载于:https://www.cnblogs.com/guibb/archive/2011/12/15/2289573.html