आप एक NOT IN()का उपयोग कर सकते हैं कोड>
, या <> कोई भी ()
SELECT CaseId
FROM CaseIdUsers
WHERE CaseID NOT IN (
SELECT CaseId
FROM CaseIdUsers
JOIN GroupMembers ON GroupMembers.User = CaseIdUsers.Sid
JOIN Groups ON GroupMembers.Group = Groups.Sid
WHERE Groups.Name = 'MyGroupName'
)
वैकल्पिक रूप से, आप बाएं जॉइन
का उपयोग कर सकते हैं GROUP BY
. के साथ
SELECT CaseId
FROM CaseIdUsers
LEFT JOIN GroupMembers ON GroupMembers.User = CaseIdUsers.Sid
LEFT JOIN Groups ON GroupMembers.Group = Groups.Sid
AND Groups.Name = 'MyGroupName'
HAVING COUNT(Groups.Sid) = 0