title: SQL - replacement for HAVING COUNT(*) == 0
body: <p>So I have to make a query to return all the reciept numbers that don't contain an &quot;apple&quot; item.</p>
  <p>The data is as follows. EG If you go to the shops and buy apples and bananas the data will be:</p>
  <pre><code>(table reciepts)
  recieptNumber      productCode
  12345              9999
  12345              8888
  
  (table products)
  productCode        productName
  9999               Apples
  8888               Bananas
  </code></pre>
  <p>I was thinking of:</p>
  <pre><code>SELECT reciepts.recieptNumber
  FROM reciepts JOIN products
  ON reciepts.productCode == products.productCode
  WHERE products.productName == &quot;Apples&quot;
  GROUP BY reciepts.recieptNumber
  HAVING COUNT(*) == 0;
  </code></pre>
  <p>But I now know that having doesn't work with count = 0 because there's nothing to count.</p>
  <p>Any suggestions?</p>