SELECT actors.first_name,actors.last_name
FROM actors
LEFT JOIN films_actors
ON actors.actor_id=films_actors.actor_id
LEFT JOIN films
ON films_actors.film_id=films.film_id
WHERE films.title="ACADEMY DINOSAUR"
AND films.title="ANACONDA CONFESSIONS"
答案 0 :(得分:3)
您可以使用HAVING COUNT(DISTINCT ...)
SELECT actors.first_name,actors.last_name
FROM actors
JOIN films_actors
ON actors.actor_id=films_actors.actor_id
JOIN films
ON films_actors.film_id=films.film_id
WHERE films.title IN ('ACADEMY DINOSAUR','ANACONDA CONFESSIONS')
GROUP BY actors.first_name,actors.last_name
HAVING COUNT(DISTINCT films.title) = 2;