How to filter SQL results in a has-many-through relation

后端 未结 13 1456
有刺的猬
有刺的猬 2020-11-21 05:17

Assuming I have the tables student, club, and student_club:

student {
    id
    name
}
club {
    id
    name
}
stude         


        
13条回答
  •  长发绾君心
    2020-11-21 06:00

    select *
    from student
    where id in (select student_id from student_club where club_id = 30)
    and id in (select student_id from student_club where club_id = 50)
    

提交回复
热议问题