I have 2 tables:
event_categories containing:
event_category_id, event_category
Sample data:
1, Tennis
2, Volleyball
3, Boxing
4, Skating
Then I have a table that joins users that might possibly be linked to any of these categories.
users_event_categories containing
user_id, event_category_id
Sample data:
1223, 2
1223, 4
5998, 2
I need a query that returns ALL event categories, and returns if a user has that category linked.
So if I query with the user_id 1223 my result would be:
1, Tennis, 0
2, Volleyball, 1
3, Boxing, 0
4, Skating, 1
Or a query with user_id 4444 would return:
1, Tennis, 0
2, Volleyball, 0
3, Boxing, 0
4, Skating, 0