select * from 学生表 where stuId in (select stuId from 关系表 group by stuId having count(*)>5;)
其中stuId是学生表主键(暂定)
select * from 学生表 where studentid in (select studentid from 关系表 group by studentid having count(*)>5)
子查询:select studentid from 关系表 group by studentid having count(*)>5 找出符合的ID
你在问什么?