Wednesday, December 1, 2010

SQL SERVER - Remove duplicate rows from a table in SQL Server


This query remove just the duplicate rows, if you have the tripled or quadrupled run more one it.

delete Table1
from
(select c1 as t
from Table1 p
having COUNT(*)>1) as t
where c1=Max(t.max)