Need SQL query help for $5

Discussion in 'MySQL' started by CBuilder, Oct 20, 2007.

  1. #1
    Hi,

    I need an SQL query that remove duplicate records from a database.

    duplicate means that records have the same value for certain columns only, which means that it is recognized as unique MySQL row, because i have ID key column in my db.

    Paymnet will be on success of the query through PayPal

    Thanks
     
    CBuilder, Oct 20, 2007 IP
  2. kashem

    kashem Banned

    Messages:
    1,250
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I woud be happy to help you , can you send sample or the dump ? My net is horribly slow. If large file it will be problem for me to download and work.
     
    kashem, Oct 20, 2007 IP
  3. DnHype

    DnHype Active Member

    Messages:
    1,011
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    80
    #3
    send me details by pm plz im up for this job
     
    DnHype, Oct 20, 2007 IP
  4. moodswing

    moodswing Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    me too send me details. I can remove your duplicates if you want by sending me your dump.
     
    moodswing, Oct 20, 2007 IP
  5. mbnaragund

    mbnaragund Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Here by i am sending a sample example try out this logic

    select * from population

    COUNTRY STATE POPULATION YEAR REGION
    --------- ------ --------- --------- --------
    india ap 20000 2000 asia
    india ap 25000 2001 asia
    india ka 23000 2000 asia
    india ka 24000 2001 asia
    usa al 18000 2000 north amer
    usa al 25600 2001 north amer
    pak ca 25980 2001 asia
    pak me 13650 2000 asia
    india up 28320 2005 asia
    india mh 15300 2003 asia

    10 rows selected.


    For deleting duplicate row:-

    Query 1:
    delete from adminuser.population ta where rownum<(select max(rownum) from adminuser.population tb where
    ta.country=tb.country and ta.population=tb.population and ta.year=tb.year and ta.state=tb.state and
    ta.region=tb.region)

    Query 2:

    delete from adminuser.population
    where rowid not in
    (select min(rowid) from adminuser.population
    group by population,year,region,country,state);
     
    mbnaragund, Oct 22, 2007 IP