* [EMAIL PROTECTED]
[...]
> Aha, now I have SUM(ROUND(how_much,2)), this works so far.
You should swap these two function calls, the way you are doing it you are
summing up the rounded values, instead you should round the sum of the
values: ROUND(SUM(how_much),2)
--
Roger
--
MySQL General Mail
* [EMAIL PROTECTED]
[...]
> Does this mean I can not trust float, decimal etc. for financial purposes?
Yes you can, but you need to consider the precission of your calculations
and comparisons. How much is 1 dollar divided by 3, if you can only use two
digits for decimals? What do you do with the
Thanks,
Roger Baklund wrote:
* [EMAIL PROTECTED]
Hello,
I have a table bill like
when (date), how_much (float), what (varchar).
Now I store some bills on it - how_much will get numbers with 2 digits
after point.
Why do you think that? Note that FLOAT is an approximate numeric type. The
value you
* [EMAIL PROTECTED]
> Hello,
> I have a table bill like
> when (date), how_much (float), what (varchar).
>
> Now I store some bills on it - how_much will get numbers with 2 digits
> after point.
Why do you think that? Note that FLOAT is an approximate numeric type. The
value you insert is stored i
Hello,
I have a table bill like
when (date), how_much (float), what (varchar).
Now I store some bills on it - how_much will get numbers with 2 digits
after point.
Then I want to know how much money I spent each month.
SELECT SUM(how_much), YEAR(when), MONTH(when) FROM bill GROUP BY
(YEAR(when)*1