NULLIF(expr1,expr2) : NULLIF « Control Flow Functions « MySQL Tutorial






Returns NULL if expr1 = expr2 is true, otherwise returns expr1.

mysql>
mysql> SELECT NULLIF(1,1);
+-------------+
| NULLIF(1,1) |
+-------------+
|        NULL |
+-------------+
1 row in set (0.00 sec)

mysql> SELECT NULLIF(NULL,2);
+----------------+
| NULLIF(NULL,2) |
+----------------+
| NULL           |
+----------------+
1 row in set (0.00 sec)








18.5.NULLIF
18.5.1.NULLIF(expr1,expr2)
18.5.2.Using NULLIF with data in a table