--结果一条记录的方法
select sum(case when score<10 then 1 else 0 end) as [0-10],
sum(case when score>=10 and score<20 then 1 else 0 end) as [10-20],
sum(case when score>=20 and score<30 then 1 else 0 end) as [20-30],
sum(case when score>=30 and score<40 then 1 else 0 end) as [30-40],
....
from student_score
我不知道你是怎么弄的,但是三楼回答的是标准答案,而且是通用语言
写存储过程就很容易搞定,用单条SQL语句,我就没有办法了。