28,391
社区成员
发帖
与我相关
我的任务
分享
'统计出各科成绩的分数段情况. 100到90有多少人,89-80有多少人, 最高分,平均分
select subject,(select count(id) from 成绩表 where score between 90 and 100 and subject=t1.subject) as 优,(select count(id) from 成绩表 where score between 80 and 89 and subject=t1.subject) as 良,(select max(score) from 成绩表 where subject=t1.subject) as 最大, (select avg(score) from 成绩表 where subject=t1.subject) as 平均 from 成绩表 t1 group by subject