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.
精彩评论