Fetch records from one table where there's not a record in another

后端 未结 2 1966
感动是毒
感动是毒 2021-01-22 08:57

SURVEYS table:

SurveyID
UserID
Question
Choice1
Choice2
Choice3

RESPONSES table:

UserID
SurveyID
         


        
2条回答
  •  耶瑟儿~
    2021-01-22 09:12

    Something like this I think should do?

    SELECT * 
    FROM Surveys s
    WHERE s.UserID != 28 
    AND s.SurveyID NOT IN (SELECT R.SurveyID FROM Responses R WHERE R.UserID = 28)
    

提交回复
热议问题