Una forma sencilla de borrar los registros duplicados en una tabla es
WITH Duplicados AS (
SELECT ROW_NUMBER() OVER(PARTITION BY [campoId1],[campoId2] ORDER BY (SELECT NULL)) AS R_ID,[campoId1],[campoId2]
FROM Tabla1)
delete Duplicados WHERE R_ID > 1;
La mano invisible controla el mundo
WITH Duplicados AS (
SELECT ROW_NUMBER() OVER(PARTITION BY [campoId1],[campoId2] ORDER BY (SELECT NULL)) AS R_ID,[campoId1],[campoId2]
FROM Tabla1)
delete Duplicados WHERE R_ID > 1;
La mano invisible controla el mundo
No hay comentarios.:
Publicar un comentario