Hello.
Not sure if this is a math or computer question.
I am scanning a table and I want to write a formula that will return a value of -1, 0 or 1 for each row depending on the value in the row.
Using a combination of the following mathematical mysql functions, I would like to return a value of :
1 if the content of the field is > 0.5
-1 if the content of the field is < 0.5 and
0 if the content of the field is > -0.5 and < 0.5
This is SQL so I am more or less limited with a combination of these functions:
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html
http://dev.mysql.com/doc/refman/5.0/en/arithmetic-functions.html
http://dev.mysql.com/doc/refman/5.0/en/numeric-functions.html
Thanks.
nimzo
Not sure if this is a math or computer question.
I am scanning a table and I want to write a formula that will return a value of -1, 0 or 1 for each row depending on the value in the row.
Using a combination of the following mathematical mysql functions, I would like to return a value of :
1 if the content of the field is > 0.5
-1 if the content of the field is < 0.5 and
0 if the content of the field is > -0.5 and < 0.5
This is SQL so I am more or less limited with a combination of these functions:
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html
http://dev.mysql.com/doc/refman/5.0/en/arithmetic-functions.html
http://dev.mysql.com/doc/refman/5.0/en/numeric-functions.html
Thanks.
nimzo