I need 3 tables that are all relevant to the same thing.
For instance, 1 has user information, 1 has page information for that user and the other has page options for that user.
all connected through user_id
is is possible to do this.
SELECT *
FROM users
LEFT JOIN page_info ON users.id=page_info.user_id
RIGHT JOIN page_settings ON user.id=page_settings.user_id
WHERE users.id=$id
or will i be defeated to using 2 queries
Thanks
I think you misunderstand what a
LEFTandRIGHTouter join do: read A Visual Explanation of SQL Joins.In your case, with the
userstable coming first (i.e. to the “left” of all others), I suspect you want both joins to beLEFTouter joins? That is: