5 回答
慕村225694
TA贡献1880条经验 获得超4个赞
select * from stu,(select course,MAX(mark) as maxscore from stu group by course) temp where stu.mark = temp.maxscore and stu.course= temp.course
饮歌长啸
TA贡献1951条经验 获得超3个赞
这样好些,select id,name,stu.mark,stu.course from stu,( select course,MAX(mark) as maxscore from stu group by course) temp where stu.mark = temp.maxscore and stu.course= temp.course
明月笑刀无情
TA贡献1828条经验 获得超4个赞
应该是group by ,sql语句为: SELECT id,name,MAX(mark),course FROM stu GROUP BY course
浮云间
TA贡献1829条经验 获得超4个赞
select s.* from stu s left join (select max(mark) m,course from stu GROUP BY course) c on s.mark=c.m and s.course=c.course where c.m is not null
添加回答
举报
0/150
提交
取消