我有以下SQL查詢。SUM中出現不正確的小數位MySQL
SELECT SUM(final_insurance_total) as total
FROM `leads`
GROUP BY leads.status
我有數據的領先表中的單個行與用於458796. final_insurance_total一個值final_insurance_total數據類型是float
。
由於某些原因,MySQL正在將單個行相加爲「458796.375」。
如果我更改查詢到
SELECT (final_insurance_total) as total
FROM `leads`
GROUP BY leads.status
返回正確的值。世界正在發生什麼?
http://bugs.mysql.com/bug.php?id=1961 –
同樣的問題在這裏http://stackoverflow.com/questions/3907021/using-sum-on-float-data –
這是一個很好的解釋https://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html – Stan