SQL计算球队积分

 

结果:

 

select name as 队名,
sum(case Score when N'胜' then 1 else 0 end)as 胜,
sum(case Score when N'平' then 1 else 0 end)as 平,
sum(case Score when N'负' then 1 else 0 end)as 负,
--自定义列 计算积分(胜+3 平+1 负+0)
sum(case Score when N'胜' then 3 when N'平' then 1 end) as 积分

from T_Scores group by name
order by 积分 desc

相关文章:

  • 2021-06-24
  • 2022-02-13
  • 2021-06-12
  • 2021-10-28
  • 2022-01-27
  • 2021-12-24
  • 2021-11-30
猜你喜欢
  • 2021-10-02
  • 2021-05-08
  • 2022-01-02
  • 2021-08-17
  • 2021-09-02
相关资源
相似解决方案