Menggunakan ROW_NUMBER dalam CTE memungkinkan Anda menghapus nilai duplikat sambil mempertahankan baris unik.
WITH q AS (
SELECT RN = ROW_NUMBER() OVER (PARTITION BY ID ORDER BY ID )
, ID
, Name
FROM ATable
)
DELETE FROM q WHERE RN > 1