nullif
description
Syntax
nullif(expr1, expr2)
If the two parameters are equal, null is returned. Otherwise, the value of the first parameter is returned. It has the same effect as the following case when
1. CASE
2. WHEN expr1 = expr2 THEN NULL
3. ELSE expr1
4. END
example
1. mysql> select nullif(1,1);
2. +--------------+
3. | nullif(1, 1) |
4. +--------------+
5. | NULL |
6. +--------------+
8. mysql> select nullif(1,0);
9. +--------------+
10. | nullif(1, 0) |
11. +--------------+
12. | 1 |
13. +--------------+
keywords
NULLIF
