title: Mysql SUM Float give wrong value
body: <p>I have the next query:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT DATE_FORMAT(stats_visits.date,'%H') AS zdate,
     count(DISTINCT stats_visits.id) AS visits,
     count(DISTINCT d.id) AS downloads,
     count(DISTINCT c.id) AS clicks,
     ROUND(SUM(d.revenue),3) AS zrevenue
  FROM stats_visits
  LEFT JOIN stats_downloads AS d on(DATE_FORMAT(d.date,'%y/%m/%d %H') = DATE_FORMAT(stats_visits.date,'%y/%m/%d %H')
                                AND d.user='4')
  LEFT JOIN stats_clicks AS c on(DATE_FORMAT(c.date,'%y/%m/%d %H') = DATE_FORMAT(stats_visits.date,'%y/%m/%d %H')
                             AND c.user='4')
  WHERE DATE(stats_visits.date) = '2014-01-31'
    AND stats_visits.user = '4'
  GROUP BY zdate
  ORDER BY zdate ASC
  </code></pre>
  <p>And it returns a wrong 'zrevenue'</p>
  <p><img src="https://i.stack.imgur.com/NXu2C.png" alt="enter image description here" /></p>
  <p>If I delete that &quot;SUM&quot; it gives this response:</p>
  <p><img src="https://i.stack.imgur.com/yj5yn.png" alt="enter image description here" /></p>
  <p>It gives one 'revenue', but in table there are 3 rows with 'date'=13 and 'revenue'=0.85.</p>
  <p>The 'zrevenue' should be 2.55, not 10.200</p>
  <p>The &quot;revenue&quot; is a decimal(8,2) and tables are &quot;InnoDB&quot;</p>
  <p>Thanks in advance!</p>