MySQL : how can i convert string to int

admin

Administrator
Staff member
Hello,


got a problem


Here's the situation :

Having two fields who i have to evaluate which one is greater ..

Problem is that they can not be of a numeric type because then a 0 will appear when it has to be void ...

Now when i try to evaluate like

... where field1 > field2

and field1 = '4' and field2 = '12' for obvious string comparision reasons the first field is evaluated is the greater one ..

How can i convert a string to a numeric field ?

I know mySql converts a string automatically to an integer when evaluating a string and a numeric field but how can i force this on an evaluation of two strings ???


thanks in advance
 
Back
Top