开发者

mysql null to 0

SELECT * from book;

how to convert NULL result t开发者_运维知识库o 0 from the sql ?


You're looking for the COALESCE keyword:

SELECT COALESCE(fieldName, 0) FROM book


SELECT IFNULL(pages, 0) FROM book;

if pages was the name of your column.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜