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 quicklabdumpID
is the primary key.
I would like to know how to keep only the largest quicklabdumpID
where there are multiple occurrences of [specimen id]