mySQL compare string as numeric
Posted on 2010-11-15
I'm querying a database I don't have control over. There is a string field which holds numbers, NULL and ''. What do I need to do to compare the string field as a number
Ex. I have the following values in the table
I want to select * from table where field < 2
It should only return 1 and 0 (I would also be OK with it treating NULL and '' as 0 and returning those), not the 11 or 2.