Replace null with 0 in MySQL(在 MySQL 中用 0 替换 null)
问题描述
我在 MySQL 的操作结果中得到 NULL
值.
I am getting NULL
values in the results of an operation in MySQL.
有没有办法将 NULL
值转换为值 0?
Is there a way to convert the NULL
values into the value 0?
推荐答案
是的,通过使用 COALESCE
.
COALESCE 遍历您给它的值列表,并返回第一个非空值.
COALESCE goes through the list of values you give it, and returns the first non-null value.
这篇关于在 MySQL 中用 0 替换 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!