Ifnull (expr1, expr2), if expr1 is not null, ifnull () returns expr1, otherwise it returns expr2. Ifnull () returns a number or string value, depending on the context in which it is used. Mysql> select ifnull (1/0);-> 1 mysql> select ifnull ();-> 0 mysql> select ifnull (, 10 ); -> 10 mysql> select ifnull (1/0, 'yes');-> 'yes' if (expr1, expr2, expr3) if expr1 is true (expr1 <> 0 and expr1 <> null), if () returns expr2; otherwise, expr3 is returned. If () returns a number or string value, depending on the context in which it is used. Mysql> select if (1> 2, 2, 3);-> 3 mysql> select if (1 <2, 'yes', 'no '); -> 'yes' mysql> select if (strcmp ('test', 'test1'), 'yes', 'no');-> 'no'
The following statements are correct and have been tested:
Select if (event <= 2, 'hahaha', event) from cti_workevent limit; select ifnull (event, 'Kong ') from cti_workevent limit; select if (event <= 2, if (event = 1, 'haha11', 'haha22'), event) from cti_workevent limit 0, 10;