Mysql select query bug with '7.56'
This seems to be a very strange issue and I can't seem to get to the
bottom of the cause. When running a mysql select statement we keep getting
no results returned but only when the value comes to a quoted '7.56'. if
we run the same query without the quotes or using a different number it
works as expected. Example queries and results below:
SELECT * FROM orders WHERE itemsTotal = '7.56' LIMIT 0 , 30
MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0334
sec )
SELECT * FROM orders WHERE itemsTotal = 7.56 LIMIT 0 , 30
Showing rows 0 - 0 ( 1 total, Query took 0.0297 sec)
Now if you change the items total to 7.57:
SELECT * FROM orders WHERE itemsTotal = '7.57' LIMIT 0 , 30
Showing rows 0 - 0 ( 1 total, Query took 0.0280 sec)
SELECT * FROM orders WHERE itemsTotal = 7.57 LIMIT 0 , 30
Showing rows 0 - 0 ( 1 total, Query took 0.0284 sec)
This is running mysql 5.5.24 for testing on local host and mysql 5.0.95 in
live environment. Same results when running this query from a PHP file and
phpmyadmin. If anyone can spot an obvious error, please let me know!
No comments:
Post a Comment