I want the name of every male director that has directed more than 20 movies and has cast in every single movie he has directed. If he has cast a movie, but hasn't directed it, that's okay and I still want his name; if he has directed any movie but hasn't cast in it, I don't want him anymore.
SELECT p.firstname,
p.lastname
FROM person p
WHERE p.gender = 'M' AND
(
SELECT COUNT(*)
FROM filmparticipation fpd
WHERE p.personid = fpd.personid AND
fpd.parttype = 'director' AND
(
SELECT COUNT(*)
FROM filmparticipation c
WHERE c.personid = fpd.personid AND
c.filmid = fpd.filmid AND
c.parttype = 'cast'
) > 0
) >= 20;
This is just one of my multiple tries. As a side question, why doesn't it work? I make sure I'm checking the correct directed movie-id to the casted movie-id etc.