[英]select from a table depending on 2 other relations
SELECT i.name
FROM instructor I
JOIN teaches T
ON I.ID = T.ID
JOIN courses C
ON C.course_id = T.course_id
WHERE C.credits = 4
另一種簡單的方法...
select * from instructors
where id in ( select distinct id
from teaches
where course_id in ( select distinct course_id
from courses
where credits = 4
)
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.