widget Posted November 24, 2009 Share Posted November 24, 2009 I have 2 tables One called members2 and one called members_profiles2 Both contain the field name "username" the mp2 table has over 1000 extra records than the m2 table. How do I create a comparison script that will... Check the usernames in mp2 and compare them with m2 and display the usernames left over? Its the left overs that I need to delete. Thanks for any help. php and MySQL Link to comment https://forums.phpfreaks.com/topic/182756-compare-data-from-1-table-with-another-help-please/ Share on other sites More sharing options...
widget Posted November 24, 2009 Author Share Posted November 24, 2009 Any ideas please? Im desperate to get it done tonight Link to comment https://forums.phpfreaks.com/topic/182756-compare-data-from-1-table-with-another-help-please/#findComment-964586 Share on other sites More sharing options...
widget Posted November 25, 2009 Author Share Posted November 25, 2009 no takers? Link to comment https://forums.phpfreaks.com/topic/182756-compare-data-from-1-table-with-another-help-please/#findComment-965264 Share on other sites More sharing options...
cags Posted November 25, 2009 Share Posted November 25, 2009 SELECT * FROM members_profiles2 WHERE username NOT IN ( SELECT username FROM members2 ) EDIT: Just realised you want to delete. Use this to check you get the right values then use DELETE. Link to comment https://forums.phpfreaks.com/topic/182756-compare-data-from-1-table-with-another-help-please/#findComment-965374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.