Following query demonstrate how to get duplicate records count in a sql server table. It uses GROUP BY, HAVING and ORDER BY clauses and order the result in descending order.
SELECT MyColumn, COUNT(*) RecordCount
FROM tblTemp
GROUP BY MyColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
Wednesday, December 19, 2012
Count Duplicate Records in Sql Server
Subscribe to:
Post Comments (Atom)
No comments:
Write comments