Monday, January 5, 2015

To delete duplicate entries from a table in oracle


To delete a duplicate entry from a table use the below query:

delete from np_tld where rowid in (select max(rowid) from np_tld group by tld having count(*) > 1)

The above query return the all the group by tld's which is having count more than 1 with in that it will select the max row id , we are going to delete all those records.

No comments: