select *FROM ( SELECT Row_Number() OVER ( PARTITION BY [OrderNum] ORDER BY ( SELECT 0
) ) AS RowNO , *FROM [GomeCPS].[dbo].[a17]) t WHERE T.RowNO > 1 ;
select * From [GomeCPS].[dbo].[a17] Where [OrderNum] in (
select [OrderNum]
From [GomeCPS].[dbo].[a17] Group By [OrderNum] Having Count([OrderNum])>1);
Delete T From(
Select Row_Number() Over(Partition By [OrderNum] Order By (SELECT 0)) As RowNumber,*
From [GomeCPS].[dbo].[a17]) T
Where T.RowNumber > 1;
Delete From Employee Where Name in (
select Name
From Employee Group By Name Having Count(Name)>1);