使用相关子查询最香:
select device_id,university ,gpa
from user_profile as u
where gpa=(
select min(gpa)
from user_profile
where university= u.university
)
order by university
1 先拉主句的语法,别名表
2 子查询里面找最低gpa
3 子查询的where用表直接链接外表别名,最终会显示所有表的信息