title: deleting records based on aggregate function criteria
body: <p>I'm using SQLite3 (version 3.8.6) and I have a list of transactions in a database.  I want to <code>DELETE</code> the records for ids which have fewer than 10 associated transactions.</p>
  
  <p>I can use this to list the ids and their count values:</p>
  
  <pre><code>SELECT id,count(id) AS cnt FROM purchases GROUP BY id HAVING cnt &lt; 10;
  </code></pre>
  
  <p>I tried to use this to <code>DELETE</code> records:</p>
  
  <pre><code>DELETE 
      FROM purchases 
  WHERE 
      id IN 
      (SELECT id,count(id) AS cnt FROM purchases GROUP BY id HAVING cnt &lt; 10);
  </code></pre>
  
  <p>However this gives me an error:</p>
  
  <pre><code>Error: only a single result allowed for a SELECT that is part of an expression
  </code></pre>
  
  <p>Is there an elegant way to accomplish this goal?  </p>