TechView with Kamlesh khaliya

Resources for OCP, Oracle Interviews(kamleshkhaliya@gmail.com)

Tuesday 13 March 2012

Write an sql to delete duplicate records ?

  
delete from T1 a
where rowid > ( select min(rowid)
from t1 b
... where b.c1 = t1.c1
and b.c2 = t1.c2 )
in the above sql your need to join both instance of the table for all columns by which you want to define the duplicate and if you are considering the entire record as duplicate then put all the columns in where clause.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home