one of my tables has an autoincremented ID “event_id” and an “event_category_id” ID. The same “event_category_id” ID can appear multiple times, thus “event_id”'s 18,19 and 25 can all have an “event_category_id” ID of 9. Normally the query would return all "event_id"s but it can happen that "event_id"s 18 and 19 are unavailable, so only ID 25 must be returned.
The pseudo query I came up with looks like this:
WHERE event_category_id = 9 (but return only 1 row instead of 5) AND event_category_id = 15 (but return only 3 rows instead of 4)
sorry for any confusion. The problem appears to be solved. Those event ids that are unavailable (they become unavailable when selected by a user) are in an array, which are then used in a WHERE NOT IN clause.