Interview Questions   Tutorials   Discussions   Programs   

DB2 - How will you delete duplicate records from a table?




315
views
asked mar August 3, 2014 06:07 AM  

How will you delete duplicate records from a table?


           

1 Answers



 
answered By Mswami   0  
It should be possible to delete directly by using the ROW_NUMBER OLAP function to number the duplicates:


DELETE FROM (
  SELECT A, ROW_NUMBER() OVER (PARTITION BY A) AS RN FROM my_table
      )
WHERE RN > 1



flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert