WITH CTE AS(
SELECT ReffId, ReffNumber,RN = ROW_NUMBER()OVER(PARTITION BY ReffId ORDER BY ReffId)
FROM dbo.tblTechnicalDetail
)
delete FROM CTE WHERE RN > 1 and ReffId is not NULL
SELECT ReffId, ReffNumber,RN = ROW_NUMBER()OVER(PARTITION BY ReffId ORDER BY ReffId)
FROM dbo.tblTechnicalDetail
)
delete FROM CTE WHERE RN > 1 and ReffId is not NULL
No comments:
Post a Comment