ลบข้อมูลที่ซ้ำใน MS SQL

WITH cte AS (
SELECT PRS_Code
, FName
, ROW_NUMBER() OVER(PARTITION BY PRS_Code ORDER BY PRS_Code DESC) AS RowNo
FROM tbl_Personal
WHERE PRS_Code IN(SELECT PRS_Code FROM tbl_Personal GROUP BY PRS_Code HAVING COUNT(*)> 1)
)
DELETE FROM cte WHERE RowNo > 1