viviosoft Posted April 4, 2011 Share Posted April 4, 2011 Hello all, I have the following JOIN statement that does run. However, I'm not getting all the data back I would expect. Both tables have EUC values, however, both tables don't have the same amount of "matching data". For example in the plist table I have more EUC values than I do in the margins table. I would like to combine the two regardless. So in both tables I have in the EUC field: AA = AA AB = AB AC = AC But I don't have in the margins table: AD = NULL AE = NULL <?php SELECT * FROM plist RIGHT JOIN margins ON margins.euc = plist.euc ?> Is there a way to combine the two tables without having the same values in each table? Thanks for any help you can provide. Quote Link to comment https://forums.phpfreaks.com/topic/232703-joining-two-tables/ Share on other sites More sharing options...
gizmola Posted April 5, 2011 Share Posted April 5, 2011 First off don't use right join. It's the same as a left join and is non-standard. Even MySQL tells you not to use it. Left join your larger table to your smaller one, and even for rows in the left table where there is no corresponding match, you'll get a row. If this is not what you're trying to do, please explain further. Quote Link to comment https://forums.phpfreaks.com/topic/232703-joining-two-tables/#findComment-1197080 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.