--输出每门功课成绩最好的学生数据,表名为 stu。mysql不是oracle
答
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
答
SELECT id,name,MAX(mark),course FROM stu ORDER BY course
答
应该是group by ,sql语句为: SELECT id,name,MAX(mark),course FROM stu GROUP BY course
答
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