Thursday, August 23, 2012

How to delete duplicate records from a table ?


SELECT col1, col2, count(*)
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1
 
or
 
delete table_a 
where rowid not in 
     (select min(rowid) from table_a 
       group by column1, column2);
 

 
  

No comments:

Post a Comment