Minggu, 18 Mei 2014

How To Find Duplicate Records in SQL


Following code is useful to select duplicate records in SQL.

For Example : Table TABLE_NAME has three columns COL1, COL2, COL3 and COL4

Now you can use below script to select duplicate records from table TABLE_NAME

SELECT count(1) TOTAL_RECORDS, * FROM TABLE_NAME group by COL1, COL2, COL3, COL4

having COUNT(1) > 1


Source:http://www.tutorialsdesk.com/2012/09/how-to-find-duplicate-records-in-sql.html

Tidak ada komentar:

Posting Komentar