sum(case when score >85 then score else 0 end ) 优秀
sum(case when score>=75 and score<85 then score else 0 end ) 良好
sum(case when score>=60 and score<75 then score else 0 end ) 及格
sum(case when score<60 then score else 0 end ) 不及格
select name 姓名,
case
when score >=85 then '优秀'
when score >=75 and score <85 then '良好'
when score >=60 and score <75 then '及格'
when score <60 then '不及格'
end 成绩
from stu