Page 1 of 1

getting float values from mysql table

Posted: Mon Apr 25, 2005 10:35 am
by dannymc1983
i have one fields stored in table of type float(3,2). this stores float values like 2.99. but what i cant understand is that if i try to select the row with the value 2.99 using this piece of SQL code for example:

Code: Select all

select * from table where value = '2.99'
it returns nothing, even though i know that 2.99 is one of the fields in the table. anyone know why this is?? and what i can do to correct it...

Posted: Mon Apr 25, 2005 11:06 am
by JayBird
i think you need to do this

Code: Select all

select * from tablename1 where round(test, 2) = round(2.99, 2)

Posted: Mon Apr 25, 2005 11:13 am
by dannymc1983
thanks, that worked!