By Using CTE -
;WITH TBLCTE(ID,EmpName,number)
AS
(
SELECT e.ID,e.EmpName,ROW_NUMBER() OVER (PARTITION BY e.ID ORDER BY e.ID) number FROM
Employee e
)
Delete from TBLCTE where number > 1
;WITH TBLCTE(ID,EmpName,number)
AS
(
SELECT e.ID,e.EmpName,ROW_NUMBER() OVER (PARTITION BY e.ID ORDER BY e.ID) number FROM
Employee e
)
Delete from TBLCTE where number > 1
No comments:
Post a Comment