Reputation: 337
I have 2 tables, permissions and permissions_inheritance
Structure of permissions : http://prntscr.com/4h94cx Structure of permissions_inheritance : http://prntscr.com/4h95gh
What I need to do is select 'administrator' as parent
of permissions_inheritance
and then the 'child' of those results to name
of permissions
So far I have:
`SELECT * FROM `permissions_inheritance`, `permissions` WHERE `parent` =` 'administrator'
but dont know what to do?
Upvotes: 0
Views: 57
Reputation: 485
You have to join the both tables :
SELECT * FROM permissions p LEFT JOIN permissions_inheritance pi ON p.child=pi.name WHERE p.parent = 'administrator';
Note : depending on what you need finally, maybe LEFT JOIN
is not the more adequat answer, but without more preicision, it should do the work ;)
Upvotes: 1