title: Deleting similar columns in SQL
body: <p>In PostgreSQL 8.3, let's say I have a table called <code>widgets</code> with the following:</p>
  
  <pre><code> id  | type | count
  --------------------
    1  | A    |   21
    2  | A    |   29
    3  | C    |    4
    4  | B    |    1
    5  | C    |    4
    6  | C    |    3
    7  | B    |   14
  </code></pre>
  
  <p>I want to remove duplicates based upon the <code>type</code> column, leaving only those with the highest <code>count</code> column value in the table.  The final data would look like this:</p>
  
  <pre><code> id  | type | count
  --------------------
    2  | A    |   29
    3  | C    |    4  /* `id` for this record might be '5' depending on your query */
    7  | B    |   14
  </code></pre>
  
  <p>I feel like I'm close, but I can't seem to wrap my head around a query that works to get rid of the duplicate columns.</p>