title: MySQL error 1054: Unknown column in having clause
body: <p>Query:</p>
  
  <pre><code>  SELECT SUM(ProductCost) 
      FROM `tblBasket` 
  GROUP BY ProductCode
    HAVING BasketSessionID = '3429782d79c68834ea698bb4116eef5e'
  </code></pre>
  
  <p>Showing Error Like: </p>
  
  <blockquote>
    <p>1054 - Unknown column 'BasketSessionID' in 'having clause'</p>
  </blockquote>
  
  <p>What is the mistake in my query?</p>
  
  <p><img src="https://i.stack.imgur.com/AJO3a.jpg" alt="alt text"></p>