取每种性别的 第一个学生:
select * from student where student_id in(Select min(student_id) FROM student group by sex)
数据库student表:

查询结果:

取每种性别的 第一个学生:
select * from student where student_id in(Select min(student_id) FROM student group by sex)
数据库student表:
查询结果:
本文标题:sql distinct 取结果第一行
本文链接:https://www.haomeiwen.com/subject/ttgddqtx.html
网友评论