-3

I have duplicate data in my table. Give the easiest code to delete the Duplicate data using index.

Mark
  • 1
  • 1
  • 3
    Possible duplicate of [Removing duplicate rows from table in Oracle](http://stackoverflow.com/questions/529098/removing-duplicate-rows-from-table-in-oracle) – Rene Aug 11 '16 at 05:34
  • Just use DISTINCT or GROUP BY, the usage of index depends on predicates in your WHERE clause. – stee1rat Aug 11 '16 at 05:42
  • SO is not a coding service; if you have a problem, do some search, try something and then, if you have a specific question on your code, post it here. – Aleksej Aug 11 '16 at 07:07
  • Explain why you state "using index". Are you having some problem with index not used? – jarlh Aug 11 '16 at 09:14
  • Add some sample table data, both before and after the delete. And show us your current query attempt! – jarlh Aug 11 '16 at 09:14

1 Answers1

0
DELETE FROM dublicate_table
WHERE row_id not in
(SELECT MIN(row_id)
FROM dublicate_table
GROUP BY column1, column2, column3);

Column1, column2, and column3 make up the identifying key for each record. You might list all your columns.

CompEng
  • 7,161
  • 16
  • 68
  • 122