Results 1 to 5 of 5

Thread: Make a query to find duplicates

  1. #1
    Join Date
    Jun 2009
    Posts
    87

    Make a query to find duplicates

    I'm working in SQL with PhpMyAdmin. I have a big table. By doing something like:
    PHP Code:
    SELECT DISTINCT upper(last_name), upper(first_name)  FROM visitors 
    I found a beautiful table with no duplicates. Indeed, using upper (or lower), take off (well I think) a problem of breakage, which allows me to really remove all duplicates. However, I would like to make a query that gives me all the fields in double and not the fields that are not duplicated. I try to have that basis for me to working on it and clean, manually. I admit not having too many ideas ...

  2. #2
    Join Date
    Nov 2008
    Posts
    1,022

    Re: Make a query to find duplicates

    PHP Code:
    select upper (last_name), upper (first_name), count (identifier
    from thetable 
    group by upper 
    (last_name), upper (first_name
    having count (identifier)> 

  3. #3
    Join Date
    Jun 2009
    Posts
    87

    Re: Make a query to find duplicates

    This request is not bad at all. Was thinking, I could not have. But it is not exactly what I need. In fact, it tells me for each record the same registration number (2,3,4 ,...).

    Example,
    Salman Khan - 3
    Amir Khan - 2
    Sameer Khan - 7 ;-)

    I have all the information for these duplicates. (as society, the city ,...). For example, to see the 3 recordings of Salman Khan, so I can see which is correct, and which I can delete. And this, according to factors in addition, as the city and society.

    Not much, but here's the basic code received by CitricAcid(thank you to him) with city and company ... Maybe it'll help a little to help

    PHP Code:
    select upper(last_name), upper(first_name), societycitycount(idfrom thetable group by upper(last_name), upper(first_namehaving count(id) > 

  4. #4
    Join Date
    Nov 2008
    Posts
    1,022

    Re: Make a query to find duplicates

    You can always add company and city in the GROUP BY clause to refine the results (in the first post, you do not speak that name). Otherwise, it's up to you from the list of duplicates (full name) and then perform the processing element by element ...

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: Make a query to find duplicates

    It depends what you call "element": ie how you define the uniqueness in your table, there is no rule on the matter: as it was said at the beginning you do not speak in name / first name, then you talk about name / first name / company / city. This is not the same thing.

    To shield the stuff in the future, I advise you to perform a check on the uniqueness before insertion, but, I guess you've checked out the stuff as is.

Similar Threads

  1. How to find total number of duplicates from lists of sheet in excel
    By Kungfu Pandey in forum MS Office Support
    Replies: 2
    Last Post: 08-01-2012, 04:51 PM
  2. How to make MS Excel LDAP query
    By denny walter in forum Windows Software
    Replies: 3
    Last Post: 27-11-2010, 06:01 AM
  3. Want to make query dependent on another query.
    By MACE in forum Software Development
    Replies: 4
    Last Post: 01-02-2010, 05:22 PM
  4. What is query to find-out age using birthdate?
    By roodiii in forum Software Development
    Replies: 3
    Last Post: 05-12-2009, 02:55 PM
  5. How to find duplicates in Picasa
    By Madison in forum Technology & Internet
    Replies: 3
    Last Post: 07-08-2009, 10:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,012,451.41437 seconds with 17 queries