Thursday, 17 October 2013

Delete Duplicate Record In Table

Problem

 This Table (TAB_NAME) contain Duplicate Data




Col_1

1
2
1
2
3
4
1
4
3
1

  Tab_Name


And my requirement. Delete duplicate data in this table




Col_1

1
2
3
4

 Tab_name


Solution: Write this sql quary


DELETE FROM TAB_NAME
      WHERE ROWID NOT IN (  SELECT MIN (ROWID)
                              FROM TAB_NAME
                          GROUP BY COL_1);

No comments:

Post a Comment