----- Original Message ----- > From: "Alex Keda" <ad...@lissyara.su> >
> mysql> SELECT SUM(`Amount`*`Cost`*(1-`Discont`)) as `Summ` FROM > `WorksCompliteAgregate` WHERE (`ContractID` = 10369 AND `Month` = 497); Based off the select you printed, this comes to EXACTLY 548.595 for the first row and 0 for the second row. > mysql> SELECT SUM(`Amount`*`Cost`*(1-`Discont`)*100)/100 as `Summ` FROM > `WorksCompliteAgregate` WHERE (`ContractID` = 10369 AND `Month` = 497); The more detailed result here, though, seems to suggest that there's a longer fraction in your table than is printed by your select. Would your column happen to be a Float? > but, my desktop calculator gives the result 548.60 Which is the correct rounding for 548.595. Check if your column is a float, and if it is, go google for floating point mathematics. They do not work the way you think they do. Use decimal(n,m) for money - or any discrete number, for that matter. Floats are not exact values, they are APPROXIMATE values. https://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html may also give you an idea of what goes wrong. -- Unhappiness is discouraged and will be corrected with kitten pictures. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql