sql学生表 班级学生表 查出所有班级学生大于90分的个数大于10的班级

stu(id,name)
cla-stu(stuid,claid)
sco(stuid,score)

select claid from cla-stu where 1=1
and stuid in (
    select stuid from sco where score>90)
group by claid having count(stu)>10

你可能感兴趣的:(sql)