mysql语法中如何把null数据转换成0

2025年02月04日 建站教程

mysql语法中如何把null数据转换成0,下面web建站小编给大家详细介绍一下关于IFNULL的用法!

基本语法:

IFNULL(birthday​, 0)

示列介绍:

mysql> select a.id,a.name,IFNULL(b.birthday​,0) as birthday​ from user as a left join
 wp_user as b on a.id=b.uid;
+----+-----------+---------------+
| id | name      | ​   birthday   |
+----+-----------+---------------+
|  1 | 小米      |    2022-10-11 |
|  2 | 小明      |             0 |
|  3 | 小王      |    2021-11-12 |
+----+-----------+---------------+

本文链接:http://so.lmcjl.com/news/22579/

展开阅读全文
相关内容