I’m having some difficulty with my JOIN and IS NULL..
Basically what I want to do is find all members who are not apart of certain group category ID’s that I specify.
SELECT m.* FROM elvanto_members AS m
LEFT JOIN elvanto_groups AS g ON g.deleted = 0
LEFT JOIN elvanto_groups_categories AS gc ON gc.group_id = g.id AND (gc.category_id = '1' OR gc.category_id = '2')
WHERE gr.id IS NULL
Some members aren’t apart of any group categories at all which is why I’ve made it a LEFT JOIN.
Am I making sense? Do you have any idea how to fix this?
Try this: