Thursday, 9 May 2013

Oracle: Delete duplicate rows - Using sub-query


Hi Everyone, 

Here we see an example of using SQL to delete duplicate table rows using an SQL sub query to identify duplicate rows, manually specifying the join columns:



DELETE 
FROM 
EMPLOYEE A
WHERE A.ROWID > ANY 
(
  SELECT 
    B.ROWID 
  FROM 
    EMPLOYEE B 
  WHERE A.EMPNO = B.EMPNO 
    AND A.ENAME = B.ENAME 
    AND A.JOB = B.JOB
)

Thanks for reading my Blog !

0 comments:

Post a Comment