浅谈mysql可有类似oracle的nvl的函数
要用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)
相关推荐
昊 2019-12-11
haiross 2020-01-14
silencehgt 2020-04-17
tangjianft 2020-01-03
xiaobing00 2011-02-07
spartmap 2019-11-03
oraclemch 2019-07-05
天涯客Blog 2011-07-31
jbossllx 2018-11-21
HackAge 2018-10-15
talkingDB 2015-01-23
江南一叶 2013-02-23
galoisgodel 2015-06-04
lweixiong 2013-01-27
oraclestudyroad 2012-06-17
anshenoracle 2012-02-21
linuxjourney 2013-09-11