WITH myCur AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col2 ORDER BY Col1) RowNo FROM MyTable) DELETE FROM myCur WHERE RowNo > 1
DELETE FROM table1 WHERE col1 NOT IN (SELECT MIN(col1) FROM table1 group by col2 ))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)