一条SQL语句查出每个班的及格人数和不及格人数,格式为:class,及格人数,不及格人数(score>=60为及格)
MySQL統計,做個筆記
select class班级,
sum(case when score>=60 then 1 else 0 end) as 及格人数,
sum(case when score<60 then 1 else 0 end) as 不及格人数
from tb1 group by class
---score為分數,class為班級
轉載地址:https://...
转载
2020-04-16 14:28:54 ·
3515 阅读 ·
0 评论