5 回答

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊
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貢獻(xiàn)1951條經(jīng)驗(yàn) 獲得超3個(gè)贊
這樣好些,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貢獻(xiàn)1719條經(jīng)驗(yàn) 獲得超6個(gè)贊
SELECT id,name,MAX(mark),course FROM stu ORDER BY course

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超4個(gè)贊
應(yīng)該是group by ,sql語句為: SELECT id,name,MAX(mark),course FROM stu GROUP BY course

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超4個(gè)贊
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
添加回答
舉報(bào)