Sunday, 18 February 2024

delete duplicate records based on the Id

 WITH CTE AS (

    SELECT ProductId,

           -- Add other columns as needed

           ROW_NUMBER() OVER (PARTITION BY ProductId ORDER BY (SELECT NULL)) AS RowNumber

    FROM Master.VehicleType

)

DELETE FROM CTE WHERE RowNumber > 1;

No comments:

Post a Comment

best

  The phrase "Everything should be made as simple as possible, but not simpler" is a quote by Albert Einstein, meaning that  while...