Reputation: 119
SELECT * from book;
how to convert NULL result to 0 from the sql ?
Upvotes: 7
Views: 2156
Reputation: 1140
You're looking for the COALESCE keyword:
SELECT COALESCE(fieldName, 0) FROM book
Upvotes: 17
Reputation: 55524
SELECT IFNULL(pages, 0) FROM book;
if pages
was the name of your column.
Upvotes: 6