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
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.
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);