Quick Search:
 
 mySQL: Remove Duplicates Jump to:  
Category: >> mySQL >> Remove Duplicates  

<< lastnext >>

Snippet Name: Remove Duplicates

Description: remove duplicates in one pass at the table

Comment: First, you need to decide which fields constitute a duplicate, list these in each of the two 'group by' clauses, replacing fld1, fld2, etc.

Language:
Highlight Mode: PLSQL
Last Modified: February 28th, 2009

DELETE FROM tablename
WHERE ROWID IN (
   SELECT ROWID
   FROM test
   GROUP BY ROWID, fld1, fld2, fld3
   MINUS
   SELECT MIN(ROWID)
   FROM test
   GROUP BY fld1, fld2, fld3);


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org