title: Get Avg to work together with count in group by SQL clause
body: <p>I have a SQL clause that looks like the following:</p>
  
  <pre><code>SELECT TOP 1000 ir.ItemID, it.Title, count(ir.ItemID) as amount
    FROM [eboghandel].[dbo].[ItemReviews] ir
    LEFT JOIN Items it on ir.ItemID = it.ID
    group by ItemID, it.Title
    order by amount desc
  </code></pre>
  
  <p>This works perfectly, and I get a list of items with most reviews. </p>
  
  <p>However, I also want to show the "average" rating of this score.</p>
  
  <p>I can easily do:</p>
  
  <pre><code>  SELECT Avg(Rating) FROM ItemReviews WHERE ItemID = '5324181'
  </code></pre>
  
  <p>Which will give my average, but I want to combine this with the previous query.</p>
  
  <p>I tried:</p>
  
  <pre><code>SELECT TOP 1000 ir.ItemID, it.Title, count(ir.ItemID) as amount, avg(ir.Rating)
    FROM [eboghandel].[dbo].[ItemReviews] ir
    LEFT JOIN Items it on ir.ItemID = it.ID
    group by ItemID, it.Title, ir.Rating
    order by amount desc
  </code></pre>
  
  <p>But this one have two issues.</p>
  
  <ul>
  <li>It calculates wrong (ahem)</li>
  <li>It seems to remove some reviews so the count is different</li>
  </ul>
  
  <p>Any idea how I can fix this SQL call?</p>