MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Jonathan Duncan Date:July 8 2004 11:23pm
Subject:Re: Weeding out duplicates
View as plain text  
Jeffrey,

That actually does a good job, thank you.  The reason I am doing this is
so that I can delete the duplicates.  However, the query you gave me
shows me the first match of a duplicate.  Is there a way to show the
last match of a duplicate instead?  I am wanting to save the first
entries but remove any later entries.  (Note: Some entries have more
than one duplication.)

Thank you,
Jonathan
 
>>><jeffrey_n_Dyke@stripped> 07/08 4:13 pm >>> 
 
>I am trying to get rid of duplicate user info entries in a database.  I

>am assuming that the email address is unique but other information,
like 
>first name, last name, address, etc are not.  The "email" field is not
a 
>unique field in the database.  I was trying something like the 
>following, but not getting what I wanted. 
 
>select distinct u1.id,u1.firstname,u1.lastname,u1.email from Users u1, 
>Users u2 where u1.email=u2.email; 
 
i *think* something like this should work 
-> select id,firstname,lastname,email from Users group by email having 
count(*)>1; 
 
group and having are the keys, if/when that does not work. 
 
HTH 
Jeff 
 
>How can I go about identifying the duplicate entries of email
addresses? 
 
>Thank you, 
>Jonathan Duncan 
Thread
Weeding out duplicatesJonathan Duncan8 Jul
  • RE: Weeding out duplicatesLachlan Mulcahy9 Jul
Re: Weeding out duplicatesjeffrey_n_Dyke9 Jul
Re: Weeding out duplicatesJonathan Duncan9 Jul
RE: Weeding out duplicatesJonathan Duncan9 Jul
  • RE: Weeding out duplicatesRobert A. Rosenberg11 Jul
RE: Weeding out duplicatesJonathan Duncan10 Jul
  • RE: Weeding out duplicatesRobert A. Rosenberg11 Jul
RE: Weeding out duplicatesJonathan Duncan12 Jul
RE: Weeding out duplicatesSGreen14 Jul