I have three tables - the user table, a site_areas table, and a user_permissions table.
the first two speaks for itself, the third one contains user_id, area_id, access, which is set to true or false.
What I'm trying to do is return a full set of results from the site_areas table for every user, along with their permissions for that area should they exist.
This is what I have so far:
Sadly that's not giving me a full set of results from the site_areas table for each user - just the site_area rows where the user has a permission value set in the user_permissions table.
site_areas.id as area_id,
user_permissions.id as permission_id,
FROM site_areas LEFT JOIN user_permissions ON site_areas.id = user_permissions.area_id , user_table
WHERE user_permissions.user_id = user_table.user_id
ORDER BY username,title
Any help would be well received.