I need to remove duplicates from a table:
;WITH cte as(
SELECT ROW_NUMBER() OVER (PARTITION BY [specimen id]
ORDER BY ( SELECT 0 ) ) RN
FROM quicklabdump)
delete from cte where RN>1
The column quicklabdumpIDis the primary key.
I would like to know how to save only the largest quicklabdumpID, where there are several occurrences[specimen id]
source
share