Finding and Deleting Duplicate Records
INF: How to Remove Duplicate Rows From a Table
SELECT col1, col2, count(*)
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1
SELECT col1, col2, col3=count(*)
INTO holdkey
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1
DELETE t1
FROM t1, holdkey
WHERE t1.col1 = holdkey.col1
AND t1.col2 = holdkey.col2
INSERT t1 SELECT * FROM holdkey
October 5, 2005 | View Comments
Jan Ole Peek's Blog by is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 Canada License. 2005 - 2010. Entries and comments feeds.







![Firefly: The Complete Series [Blu-ray]](http://ecx.images-amazon.com/images/I/51D1Jato68L._SL160_.jpg)
![Serenity [Blu-ray]](http://ecx.images-amazon.com/images/I/51JDWLU5VNL._SL160_.jpg)