title: MySQL WITH ROLLUP returns incorrect (or unexpected) results
body: <p>I have a set of data which defines ratings in a survey table for events at different locations.</p>
  
  <p>I am trying to display the average rating for each location with the average for all locations in the final row.</p>
  
  <p>At the moment, my query looks like this:</p>
  
  <pre><code>SELECT 
  IFNULL(l.title, 'Total') AS location,
  ROUND(AVG(NULLIF(s.rating, 0)), 2) AS rating
  FROM surveys s 
  INNER JOIN events e
  ON e.id = s.event_id
  INNER JOIN locations l
  ON l.id = e.location_id
  GROUP BY l.title WITH ROLLUP
  </code></pre>
  
  <p>This gives me the following values for each location:</p>
  
  <pre><code>8.22, 8.67, 8.67, 8.56, 7.86, 8.50. 8.78, 7.33
  </code></pre>
  
  <p>However, the final Total is returned as 8.37 but it should actually be 8.32.</p>
  
  <p>Am I doing something wrong? </p>