At 10:25 -0600 on 07/09/2004, Jonathan Duncan wrote about Re: Weeding out duplicates:

Lachlan,

I want to identify the entries in the table where the email addresses
are the same as another entry.  Whatever else is in the record does not
matter to me.

However, a second requirement for the query is that it show me the last
duplicate instead of the first.  This way I keep the first entries and
remove subsequent ones.

Thanks,
Jonathan Duncan

If you are willing to go with a PHP/MySQL solution as opposed to a pure MySQL one, try this:


1) Use that query to get a list of what Email Addresses are duplicated.
2) Now do a query with a WHERE Email=Duplicate-Email-Address and fetch the Primary Key.
3) Do a Delete by Primary Key for all rows fetched in 2 EXCEPT for those keys fetched in 1.


The sequence is that you do step 1, loop though the results one at a time (step 2) doing step 3 in that loop.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to