更新时间:2023-11-26 16:41:28
使用 IFNULL:
IFNULL(expr1, 0)
来自文档:
如果 expr1 不为 NULL,IFNULL() 返回 expr1;否则返回 expr2.IFNULL() 返回数字或字符串值,具体取决于使用它的上下文.
If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.