11.3.28 NULLIF(value1,value2)函数
NULLIF(value1,value2)函数用于比较两个字符串,如果value1与value2相等,则返回NULL,否则返回value1。使用示例如下:
mysql> SELECT NULLIF('mysql','mysql'),NULLIF('mysql', '');
+-------------------------+---------------------+
| NULLIF('mysql','mysql') | NULLIF('mysql', '') |
+-------------------------+---------------------+
| NULL | mysql |
+-------------------------+---------------------+
1 row in set (0.00 sec)