Jaynesh Posted July 11, 2011 Share Posted July 11, 2011 Hello I have query I would like to know how I would go about doing this. (highlighted in red) Joining share.user_id with something other then dbPosts. SELECT * FROM dbPosts LEFT JOIN dbUsers ON dbPosts.username_id = dbUsers.id LEFT JOIN dbPosts_share ON share.user_id = dbFriends.friend_id Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/ Share on other sites More sharing options...
Kustom_Vegas Posted July 11, 2011 Share Posted July 11, 2011 should be able to simply add another table into your join statement.. "SELECT * FROM dbPosts, dbUsers, tbl_2 WHERE dbPosts.username_id = dbUsers.id AND share.user_id = tbl_2.field" Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/#findComment-1241376 Share on other sites More sharing options...
Jaynesh Posted July 11, 2011 Author Share Posted July 11, 2011 hi is there no way of doing by still using LEFT JOIN? Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/#findComment-1241385 Share on other sites More sharing options...
Kustom_Vegas Posted July 11, 2011 Share Posted July 11, 2011 what i gave you is a form of a join, why do you need the word JOIN in the statement if my method works? But if you insist...here Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/#findComment-1241401 Share on other sites More sharing options...
Jaynesh Posted July 11, 2011 Author Share Posted July 11, 2011 Hi Isnt left joins and inner joins a more healthier alternative? Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/#findComment-1241403 Share on other sites More sharing options...
fenway Posted July 14, 2011 Share Posted July 14, 2011 You seem to be posting a lot of topics on the same single item. Quote Link to comment https://forums.phpfreaks.com/topic/241677-joining-multiple-tables/#findComment-1242495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.