jarv Posted December 20, 2009 Share Posted December 20, 2009 my original code displays all records "SELECT * FROM wmb_members ORDER BY rsDatetaken DESC LIMIT $offset, $rowsPerPage" my new code with INNER JOIN only displays 1 record but in my wmb_pics table I have 3 columns PicID, UserID and fileName and is only populated with 1 user! "SELECT * FROM wmb_members INNER JOIN wmb_pics ON wmb_members.UserID=wmb_pics.UserID ORDER BY rsDatetaken DESC LIMIT $offset, $rowsPerPage" Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/ Share on other sites More sharing options...
jarv Posted December 20, 2009 Author Share Posted December 20, 2009 please help! Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-980995 Share on other sites More sharing options...
Mchl Posted December 20, 2009 Share Posted December 20, 2009 If there's jsut one row in wmb_pics that's how many rows you will get from inner join. What would you like to get? Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981002 Share on other sites More sharing options...
jarv Posted December 20, 2009 Author Share Posted December 20, 2009 I want the wmb_pics.fileName and ALL of wmb_members WHERE userID = UserID Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981013 Share on other sites More sharing options...
Mchl Posted December 20, 2009 Share Posted December 20, 2009 Use LEFT JOIN then Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981020 Share on other sites More sharing options...
jarv Posted December 20, 2009 Author Share Posted December 20, 2009 left join shows 2 results?! Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981029 Share on other sites More sharing options...
jarv Posted December 20, 2009 Author Share Posted December 20, 2009 there should be 15 or so records showing Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981107 Share on other sites More sharing options...
haku Posted December 21, 2009 Share Posted December 21, 2009 Show us the table structure, and the values for the 15 results you are expecting. Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981255 Share on other sites More sharing options...
gizmola Posted December 21, 2009 Share Posted December 21, 2009 You have a limit in your query. That could be limiting the number of rows you return. Quote Link to comment https://forums.phpfreaks.com/topic/185778-inner-join-returns-1-record/#findComment-981277 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.