如何将mysql查询的null结果替换成0?
发布日期:2021-05-14 01:21:45 浏览次数:20 分类:精选文章

本文共 1125 字,大约阅读时间需要 3 分钟。

������������

���������MySQL���������������������������������������������_null���������������������������������������������������������������������������������������������������������������������������������_null������������������0���

������������

������������MySQL������
COALESCE���������������������������������������������������������������������������������
NULL���������������������������������
NULL������������
NULL������������ -
select coalesce(1, 2, 3); ������1 -
select coalesce(null, 2, 3); ������2 -
select coalesce(null, null, 3); ������3

���������������������������������������������������������0���������������������_null���0���������������������

  • select phrase, COALESCE(ip, 0) from log where id = 6;

������������

���������������������������������������������
ip������������������������������������0������������������������������������������������������������������������������������������������������������

������������

������������������������������
ip������������������������������������������
ip���������������������������SQL��������������������������� -
select phrase, COALESCE(ip, 0) from log where id = 6;
上一篇:QMap 如何根据value排序?
下一篇:如何让QTableWidget的列占满表格?

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月05日 09时49分13秒