表t_stu;其中三个字段:name,gender,grade;要求用一条sql语句查出男生前5名和女生前5名
select * from t_stu a where 5>(select count(*) FROM t_stu where gender=a.gender AND grade>a.grade) order by a.grade desc
表t_stu;其中三个字段:name,gender,grade;要求用一条sql语句查出男生前5名和女生前5名
select * from t_stu a where 5>(select count(*) FROM t_stu where gender=a.gender AND grade>a.grade) order by a.grade desc