title: SQL to delete duplicate records with some common field values?
body: <p>Consider a table with the following schema:</p>
  
  <pre><code>id, location, starred
  </code></pre>
  
  <p>There are many records with the same location:</p>
  
  <pre><code>id | location | starred
  -----------------------
  1     rome      yes
  2     rome      no
  3     rome      no
  4     milan     yes
  5     milan     no
  6     bozen     no
  </code></pre>
  
  <p>I want to have at most one record per location. And given the choice between a starred record and a not starred record I want the starred.
  So what sql will produce this table:</p>
  
  <pre><code>id | location | starred
  -----------------------
  1     rome      yes
  4     milan     yes
  6     bozen     no
  </code></pre>
  
  <p>I suspect this could be done with some virtual tables or ªviews'. </p>
  
  <pre><code>DELETE FROM table
  GROUP BY location, 
  </code></pre>