Pomocí 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)
Pomocí 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
Pomocí 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)
Z uvedených možností NOT IN
a LEFT JOIN/IS NULL
jsou ekvivalentní, i když preferuji NOT IN
protože je čitelnější.