我的表结构
student_info
id
name
profession
score
id
姓名
分数
专业
按分数段统计
400到500人数,300到400人数
select
count(case when score between 400 and 500 then 1 end) as 400到500,
count(case when score between 300 and 400 then 1 end) as 300到400
from student_info;
按分数段和专业统计
400到500人数,300到400人数
select
count(case when score between 400 and 500 then 1 end) as 400到500,
count(case when score between 300 and 400 then 1 end) as 300到400
from student_info GROUP BY profession;