Joining 3 tables - doing joins how to
- by Kieran
This is my current query - its not getting the required result. I want it do display all of the "resources" even if they dont have a connection.
SELECT *
FROM (`user_permissions`)
JOIN `user_groups` ON `user_groups`.`id` = `user_permissions`.`role`
JOIN `user_resources` ON `user_resources`.`id` = `user_permissions`.`resource`
WHERE `role` = '4'
When I try left join or right join it still returns the same result. The result I get is:
id | role | resource | name
5 | 4 | 2 | Changelog
I want
id | role | resource | name
5 | 4 | 2 | Changelog
null | null | null | Resource2
null | null | null | Resource3
Is this possible?