According to the docs a if works as follows:
IF(expr1,expr2,expr3)
If expr1 is
TRUE
(expr1 <>0
and expr1 <>NULL
) thenIF()
returns expr2; otherwise it returns expr3 [...].
Here is a random fiddle that represents my problem: http://ift.tt/1pO2Rgr
Basically what I'm trying to do is the following:
SELECT IF(whatever, 1, 2) FROM testing WHERE whatever = 'abc';
Since there is a record there that matches my WHERE
clause it basically means that whatever
won't be 0
or NULL
like specified in the docs. Then why am I getting expression3 as result?
Aucun commentaire:
Enregistrer un commentaire