title: SELECT QUERY WITH COUNT()
body: <p>In this query there is an error:</p>
  
  <pre><code>"Column 'upload_news.upload_time' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause."
  </code></pre>
  
  <p>I want to display number of records that are related to distinct country with country name between two dates;</p>
  
  <pre><code>select count(Distinct news_id) AS TotalRecords, country 
  from upload_news 
  group by country 
  having [upload_time] between GetDate()-2 AND GetDate()
  </code></pre>