- 博客(1)
- 收藏
- 关注
原创 sum(case when status=1 then 1 else 0 end)
以下有两张表,需要合并按投资额度倒序排序SELECT time 时间, sum(case when score= "90" then 1 else 0 end) as 胜,sum(case when result = "负" then 1 else 0 end) as 负 from Student GROUP BY time;简要说明:when score= “90” : 为判断条件,then 1 selse 0 end: 当以上判断条件成立,则为1; 而该语句是在sum中的,具有累加效果,
2020-08-14 12:29:34 6246
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人