NULLIF()
Returns NULL
if
, otherwise returns expr1
= expr2
expr1
.
Prototype
mixed NULLIF(expression expr1, expression expr2)
Parameters
- expr1 - Expression to evaluate and return if it does not evaluate to NULL.
- expr2 - Expression to evaluate and return if expression evaluates to NULL.
Return
Returns NULL
if
, otherwise returns expr1
= expr2
expr1
. The return value has the same type as the first argument.
Example
SELECT NULLIF(Username, Name) AS UniqueUsername FROM User