Is there an if or if else type s开发者_JAVA百科tatement for mysql.
There is an if else construct:
IF(value == x, 1, 0)
This returns 1 if value equals x and 0 otherwise.
As JoshD said, yes there is. Here is the reference in the MySQL Online Manual: http://dev.mysql.com/doc/refman/5.0/en/if-statement.html
There's an IF()
function:
IF(expr1,expr2,expr3)
And an IF
Statement.
IF search_condition THEN statement_list
[ELSEIF search_condition THEN statement_list] ...
[ELSE statement_list]
END IF
精彩评论