Sunday, July 8, 2012

MySQL IF NULL return 0 - IFNULL() function

Test if expression is NULL; return NULL if true, return expression if false.

Definition:
IFNULL(expr1, expr2)

Example:
IFNULL(SELECT MAX(field) FROM table, 0)

No comments: