数据表:create table 'score'

('sno' int,

`score` int

);

统计成绩及格与不及格的人数;

用 case when .. then .. else .. end

==========================

select sno,

sum(case when score >=60 then 1 else 0 end) as 'good',

sum(case when score < 60 then 1 else 0 end) as 'bad'

from 'score'

==============

查询结果为 array(sno=>号码,good=>总数,bad=>总数)

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-11-15
  • 2022-01-31
  • 2021-11-05
相关资源
相似解决方案