title: Removing duplicates using partition by SQL Server
body: <p>I need to remove duplicates from a table:</p>
  
  <pre><code>;WITH cte as(
  SELECT ROW_NUMBER() OVER (PARTITION BY [specimen id]
                                         ORDER BY ( SELECT 0 ) ) RN
           FROM   quicklabdump)
          delete from cte where RN&gt;1
  </code></pre>
  
  <p>The column <code>quicklabdumpID</code> is the primary key.</p>
  
  <p>I would like to know how to keep only the largest <code>quicklabdumpID</code> where there are multiple occurrences of <code>[specimen id]</code></p>