MySQL Forums
Forum List  »  PHP

summarize values and Update
Posted by: Mik Fisher
Date: June 11, 2018 10:05AM

Hello

Help me please with a problem
I'm need to summarize two numbers: old value with current value and replace it

Type for 'profit' is Decimal (10,2)

Query # 1:
UPDATE table SET profit = profit + 0.01

the initial value of profit = 0.00
after the execution profit = 0.02


Query # 2:
UPDATE table SET profit = profit + 0.03

the initial value of profit = 0
after the execution profit = 0.06

etc.
100.00 + 0.1 = 100.20
100.00 + 1 = 102.00

why is this happening and whats wrong?

mysql ver. 5.5.25 (local Denwer)

thanks

Options: ReplyQuote


Subject
Written By
Posted
summarize values and Update
June 11, 2018 10:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.