How would I remove duplicate entries?

Discussion in 'MySQL' started by ShiftChip, Feb 27, 2007.

  1. #1
    I recently purchased a DB from a DP member that contains a large amount of duplicate entries… I’m looking for a program that’s able to loop through the DB and removed dup content based on entire titles.
     
    ShiftChip, Feb 27, 2007 IP
  2. Scolls

    Scolls Guest

    Messages:
    70
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What platform?

    If you're not concerned which titles you're deleting, why not just create a new table using distinct?

    eg. create table new_table (select distinct(title) title,[...rest of field list you want to keep...])
     
    Scolls, Feb 28, 2007 IP
  3. m1l

    m1l Active Member

    Messages:
    101
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    The platform is important but as well as the way mentioned above, if there is chance of the title being the same but the content having minor difference on some platforms you could create a table with a unique index on the title and it would exclude the duplicates.
     
    m1l, Mar 2, 2007 IP
  4. ShiftChip

    ShiftChip Well-Known Member

    Messages:
    365
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #4
    mysql Database
     
    ShiftChip, Mar 2, 2007 IP
  5. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #5
    use distinct in your sql query to eliminate duplicate and show only unique ones.

    SELECT DISTINCT title
    FROM <table>
     
    olddocks, Mar 5, 2007 IP
  6. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #6
    just join on a itself (making a tmp table), only selecting the ID and a Count of the IDs. Then order this by Count DESC. This way you will get a list of the dupes and you can sort out what you want to do with each :)
     
    ccoonen, Mar 5, 2007 IP