Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Precisa excluir registros duplicados da tabela usando row_number()

WITH cte AS
(
    SELECT ROW_NUMBER() OVER(PARTITION by ID ORDER BY name) AS Row
    FROM test
)

DELETE FROM cte
WHERE Row > 1