题解:
- 由gpa最低,知: min(gpa)
- 由每个学校,知:order by university
- 法一:
select b.device_id,a.university,a.gpa
from user_profile as b,
(select device_id,university,min(gpa) gpa from user_profile
group by university) as a
where a.university=b.university and a.gpa=b.gpa
order by a.university
- 法二:
select device_id,university,gpa
from user_profile u
where gpa=(select min(gpa) from user_profile where university=u.university )
order by university