If a price in a row is 38.03
, then the following search restrictions should all return the row containg the result.
WHERE price >= \'38.02\' AND pr
keep in mind that float
is a flawed data type when it comes to precision. If you represent 12
as float, you will get 11.99999999999998
or something.
'38.03'
can be converted to decimal, or other data type that is more precise (depending on RDBMS, I am being general here), and it will differ from the float value.
float is 32 bit, low precision. Double works a lot better, being 64 bit data type. Decimal data type in some systems are 128 bit numeric data types for storing very precise numeric values, and is usually used for denominating money.
And, skip the habit of comparing using the =
operator, of float
values. Floats are used for approximate and fast calculations, and only comparison with a range is acceptable for checking the value of a float
. That's valid for basically every single system.
When you use quotes (') your variables will be treated as strings. I think thats your problem.
Try: WHERE price >= 38.03 AND price <= 38.03