Query and delete duplicate records of SQL statement 1, find redundant records in the table, duplicate records are based on a single field (ID) to determine the select * from table where Id in (the Select ID from table group Byid having count (ID) > 1) 2, delete redundant records in the table, duplicate records are based on a single field (ID) to judge, leaving only rowid the smallest record delete from table WHERE (ID) in (the SELECT ID from table GROUP by Id has COUNT (ID) > 1) and ROWID not in (SELECT MIN (ROWID) from table GROUP by ID have COUNT (*) > 1); 3. Find redundant duplicate records in the table (multiple fields) SELECT * FROM Table a WHERE (A.ID,A.SEQ) in (Select Id,seq from table group by ID,SEQ have count (*) > 1) 4 , delete extra duplicate records (multiple fields) in the table, leaving only the rowID minimum record delete from Table A where (A.ID,A.SEQ) in (Select Id,seq from table group by ID,SEQ have count ( *) > 1) and rowID not in (select min (rowid) from table group by ID,SEQ have Count (*) >1) 5, lookup table redundant duplicate records (multiple fields), does not contain ROWID minimum Record select * FROM Table a WHERE (A.ID,A.SEQ) in (Select Id,seq from table group by ID,SEQ have count (*) > 1) and rowID not in (select min (rowid) from table group by ID,SEQ have Count (*) >1)
Oracle deletes duplicate records, leaving only one line