
CodePudding user response:
; WITH cte AS (
Select *, ROW_NUMBER () OVER (PARTITION BY repeating field 1, 2 ORDER BY repeating field GETDATE ()) rn from table
)
The DELETE FROM cte WHERE rn<> 1
CodePudding user response:
; WITH cte AS (
Select *, ROW_NUMBER () OVER (PARTITION BY repeating field 1, 2 ORDER BY repeating field GETDATE ()) rn from table
)
The DELETE FROM cte WHERE rn<> 1