选出每科的最高分
Lisng 语文 80
Nonly 语文 78
Jiang 数学 88
Lxy 数学 80
Jacky 外语 99
Andy 数学 66
select b.stu_id,stu_name,a.course,a.score
from
(select course,max(score) as score from stu_info group by course) as a,
stu_info as b
where b.course=a.course and b.score=a.score
分组后,只会出现
语文
数学
外语
score应该是一组,所以用max取最大值
更强的
select * from stu_info as a
where score=(select max(score) from stu_info where course=a.course)