SQL Get Users By One Group But Exclude Others
SELECT 
    id
FROM 
    users as u
    LEFT JOIN groups 
        ON groups.user_id = u.id
WHERE 
    groups.name = 'A'
    AND NOT EXISTS (
        SELECT 
              1 
        FROM 
            groups 
        WHERE 
            user_id = u.id 
            and name IN ('B', 'C', 'D')
    )