1

I have a replication of around 200 records in a table, I want to remove all of then except one, how can I do this ??

KeenLearner
  • 685
  • 1
  • 8
  • 25

2 Answers2

0

Source http://www.devx.com

It's easy to introduce duplicate rows of data into Oracle tables by running a data load twice without the primary key or unique indexes created or enabled.Here column1, column2, column3 constitute the identifying key for each record.

DELETE FROM our_table
WHERE rowid not in
(SELECT MIN(rowid)
FROM our_table
GROUP BY column1, column2, column3) ;
M. Wiśnicki
  • 6,094
  • 3
  • 23
  • 28
-2

use the following query. This will be applicable if there is an Id available for the table.

delete from tableA where id in(select top 199 id from tableA)