Update in MySQL returning "Rows matched: 1 Changed: 0 Warnings: 0"
In mysql updates, when the values in the row don't actually change, it doesn't count toward the changed row count (obviously).
"Changed" means "the new values are different from the old values".
The reason an update doesn't change the value of your row is because of rounding issues. You have defined amount
as float(8,2)
. You are then changing the value from 407481.25
to 407481.24
- the difference is mere 0.01 between them but we know that computers have rounding issues.
Due to the fact that an update doesn't write the new value, it's 100% safe to conclude that MySQL sees the two numbers as the same due to rounding issues. If a record isn't really altered, MySQL won't write it down - this is an optimization step, MySQL won't involve hard drive into work if it doesn't have to.
Now, this means you need to adjust your amount
column type and change it to either an integer and then internally move the decimal point for two places to the left or use a data type such as decimal
with larger decimal digits maximum number (for example: amount DECIMAL(8,4)
).