title: How to select data where sum is greater than x
body: <p>I am very new to SQL and am using SQLite 3 to run basket analysis on sales data.</p>
  
  <p>The relevant columns are the product ID, a unique transaction ID (which identifies the basket) and the product quantity.  Where a customer has bought more than one product type, the unqiue transaction ID is repeated. </p>
  
  <p>I am wanting to select only baskets where the customer has bought more than 1 item.</p>
  
  <p>Is there any way on SQLite to select the unique transaction ID and the sum of the quantity, but only for unique transaction IDs where the quantity is more than one?</p>
  
  <p>So far I have tried:</p>
  
  <pre><code>select uniqID, sum(qty) from salesdata where sum(qty) &gt; 1 group by uniqID;
  </code></pre>
  
  <p>But SQLite gives me the error 'misuse of aggregate: sum()'</p>
  
  <p>Sorry if this is a simple question but I am struggling to find any relevant information by googling!</p>