title: How to delete all records returned by a subquery?
body: <p>I want to delete all records that are returned by a certain query, but I can't figure out a proper way to do this. I tried to <code>DELETE FROM mytable WHERE EXISTS (subquery)</code>, however, that deleted all records from the table and not just the ones selected by the subquery. </p>
  
  <p>My subquery looks like this:</p>
  
  <pre><code>SELECT 
  MAX(columnA) as columnA,
  -- 50 other columns
  FROM myTable 
  GROUP BY
  -- the 50 other columns above
  having count(*) &gt; 1;
  </code></pre>
  
  <p>This should be easy enough, but my mind is just stuck right now. I'm thankful for any suggestions.</p>
  
  <p>Edit: columnA is not unique (also no other column in that table is globally unique)</p>