表数据
可以先查出最早分
SELECT c.username,MAX(c.score) maxscore from clazz c group by c.username;
得到以下信息
再查询
SELECT c.username,c.subjects,c.score '最高分' FROM (SELECT c.username,MAX(c.score) maxscore from clazz c group by c.username) t , clazz c
WHERE
t.maxscore = c.score
AND
t.username = c.username;
得到