Hello, I want to delete the duplicate email addresses from a single table, called contact, containing the field called yemail datatype varchar. What is the best way to remove this data when copying the table. The original table had no unique index requirements, but now I want the new table to have a unique index on the yemail field, but I've run into a roadblock trying to import the existing data which has duplicates in this field.
This identifies the duplicates: select yemail, count(yemail) as 'duplicate' from contact GROUP BY yemail HAVING duplicate > 1 ... but I run into trouble here: delete from contact WHERE select yemail, count(yemail) as 'duplicate' from contact GROUP BY yemail HAVING duplicate > 1 ... according to the docs subselects are not supported for the delete syntax. So what will work? BTW, mysql has come a long way since I first started using it. Keep up the good work! Kind Regards, Richard Creech [EMAIL PROTECTED] 250.744.3350 Pacific Time Canada Easily create your own phpYellow Pages http://www.dreamriver.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php