;WITH CETAS (SELECT *, ROW_NUMBER() OVER (PARTITION BY SearchTask_PKID ORDER BY SearchTask_PKID) RowNoFROM [SiteAnalysis].[dbo].[UrlQueue] ) DELETE CET WHERE RowNo > 1