sql查询每门课程成绩最高的学生
给出数据库(sco)如下图:

查出每门课程成绩最高的学生
1 select b.id,b.kemu,b.name,b.chengji 2 from (select kemu,max(chengji) maxc 3 from sco group by kemu) a,sco b 4 where a.kemu=b.kemu and a.maxc = b.chengji;
其中
select kemu,max(chengji) maxc from sco group by kemu
表示查出每科最高成绩和对应科目
查询出每科最高成绩之后,从所有成绩中查询对应的学生的详细信息
浙公网安备 33010602011771号