Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Aggiorna uno dei 2 duplicati in una tabella di database del server sql

Prova questo con CTE e PARTITION BY

;WITH cte AS
(
  SELECT
      ROW_NUMBER() OVER(PARTITION BY Column1  ORDER BY Column1 ) AS rno,
      Column1 
  FROM Clients
)

UPDATE cte SET Column1 =Column1 +' 1 '
WHERE rno=2