I'm trying to write a query that get's all users that belong to Group
A, but excludes users that belong Groups
Users can belong to multiple groups.
I have the following query but it's not working:
SELECT id FROM users LEFT JOIN groups USING (user_id) WHERE groups.name = 'A' AND groups.name NOT IN ('B', 'C', 'D')
This just selects all users from group
A, how do I exclude anyone who also belongs to groups