Ved brug af NOT IN:
SELECT s.*
FROM SURVEYS s
WHERE s.userid != 28
AND s.surveyid NOT IN (SELECT r.survey_id
FROM RESPONSES r
WHERE r.userid = 28)
Brug af LEFT JOIN/IS NULL:
SELECT s.*
FROM SURVEYS s
LEFT JOIN RESPONSES r ON r.survey_id = s.surveyid
AND r.user_id = 28
WHERE s.userid != 28
AND r.userid IS NULL
Ved brug af NOT EXISTS:
SELECT s.*
FROM SURVEYS s
WHERE s.userid != 28
AND NOT EXISTS (SELECT NULL
FROM RESPONSES r
WHERE r.userid = 28
AND r.survey_id = s.surveyid)
Af de angivne muligheder er NOT IN
og LEFT JOIN/IS NULL
er ækvivalente, selvom jeg foretrækker NOT IN
fordi den er mere læsbar.