dflow Posted June 19, 2011 Share Posted June 19, 2011 i have 2 tables: old new field is name: what this the correct way to compare new entries(not in old)? Quote Link to comment https://forums.phpfreaks.com/topic/239796-compare-2-tables/ Share on other sites More sharing options...
AbraCadaver Posted June 19, 2011 Share Posted June 19, 2011 Not positive, but try: SELECT name FROM new WHERE name <> (SELECT name FROM old) Quote Link to comment https://forums.phpfreaks.com/topic/239796-compare-2-tables/#findComment-1231778 Share on other sites More sharing options...
dflow Posted June 19, 2011 Author Share Posted June 19, 2011 Not positive, but try: SELECT name FROM new WHERE name <> (SELECT name FROM old) iget error Subquery returns more than 1 row Quote Link to comment https://forums.phpfreaks.com/topic/239796-compare-2-tables/#findComment-1231780 Share on other sites More sharing options...
dflow Posted June 19, 2011 Author Share Posted June 19, 2011 ok the correct syntax is: SELECT name FROM new WHERE name NOT IN (SELECT name FROM old) thanks Quote Link to comment https://forums.phpfreaks.com/topic/239796-compare-2-tables/#findComment-1231781 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.