Welcome Guest, Not a member yet? Register   Sign In
IF statement in an MySQL query
#12

[eluser]CroNiX[/eluser]
It should be legal. Try it in raw mysql. The field is in the first parameter to the IF clause. The return values are the 2nd, or 3rd depending on if the first parameter equated to true/false. Maybe he wants a decimal returned and not a string, which is what he would get if it was surrounded by quotes.

This is valid mysql:
Code:
select if(1 = 1, .01, .05) as test;
and will return a decimal value, 0.01, as test.


Messages In This Thread
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:08 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:31 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:01 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:06 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:09 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:17 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 02:40 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 10:41 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:44 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:51 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:00 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:08 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB