webCOMAND

IFNULL()

Return the result of an expression if it is not NULL, otherwise return the result of an alternative expression.

Prototype

mixed IFNULL(expression expression, expression alternative)

Parameters

  • expression - Expression to evaluate and return if it does not evaluate to NULL.
  • alternative - Expression to evaluate and return if expression evaluates to NULL.

Return

Result of the expression if not NULL, otherwise result of the alternative expression.

Example

SELECT OID, IFNULL(LastLogin.Timestamp,'Never') AS When FROM User

Related

IF(), ISNULL()