要用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)
2025国考·省考课程试听报名