Utiliser 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)
Utiliser 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
Utiliser NON EXISTE :
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)
Parmi les options répertoriées, le NOT IN
et LEFT JOIN/IS NULL
sont équivalents bien que je préfère le NOT IN
parce que c'est plus lisible.