title: How to count 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 count the number of baskets where the customer has bought 1 item.</p>
  
  <p>So far I have tried <code>select count(distinct uniqID) from salesdata having sum(qty) = 1;</code></p>
  
  <p>But this brought up an error saying <code>a GROUP BY clause is required before HAVING</code>.</p>
  
  <p>I then tried <code>select count(distinct uniqID) from salesdata group by uniqID having sum(qty) = 1</code></p>
  
  <p>SQlite accepted this, but returned me a list of just 1s, which isn't right either!</p>
  
  <p>I then tried <code>select count(uniqID) from salesdata group by qty having sum(qty) = 1</code></p>
  
  <p>SQlite also accepted this but returned nothing at all.</p>
  
  <p>Any ideas would be hugely appreciated!</p>
  
  <p>E</p>