I'm trying to do a simple update query in MySQL but it doesn't work:
UPDATE dimensions
SET is_active = 1
WHERE eco_tax = 19.2;
eco_tax is a FLOAT type column and it seems that here is the problem, because when I try updating with an INT column it works.
So what cand I do to use a float in column in my where syntax in MySQL?
I always encounter issues when i want to do WHERE
s in databases, and it is most likely a issue with floating point math. I know that doubles work the same way, but for some odd reason, it always works with using doubles. Therefore, my suggestion to you is to change the datatype to double instead.
Use double
instead of float
. It seems there has a bug of mySql. See the following link for more information.
http://bugs.mysql.com/bug.php?id=14268
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With