时间:2021-07-01 10:21:17 帮助过:35人阅读
要用ifnull,而不是isnull
isnull是判断是否为null,返回值是1表示null或者0表示不为空
ifnull等同于oracle的nvl,用法如下
mysql> select ifnull(1,10); +--------------+ | ifnull(1,10) | +--------------+ | 1 | +--------------+ 1 row in set (0.00 sec) mysql> select ifnull(null,10); +-----------------+ | ifnull(null,10) | +-----------------+ | 10 | +-----------------+ 1 row in set (0.00 sec)
isnull的用法如下
mysql> select isnull(null); +--------------+ | isnull(null) | +--------------+ | 1 | +--------------+ 1 row in set (0.00 sec) mysql> select isnull(1); +-----------+ | isnull(1) | +-----------+ | 0 | +-----------+ 1 row in set (0.00 sec)
以上就是浅谈mysql可有类似oracle的nvl的函数的详情的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!