I have two mysql tables, event_template and event_occurrence, where event_occurrence has a column with event_template id's. I want to find all event_templates which have no event_occurrence.
Trying this query I get 0 rows:
SELECT * FROM `event_template` where id NOT IN (SELECT event_template_id FROM event_occurrence)
Note that event_template has 166 rows, and 162 are returned by this query:
SELECT * FROM `event_template` WHERE id IN (SELECT event_template_id FROM event_occurrence)