Prevent SUM() for returning NULL


#1

Hi, I noticed that when the N1QL function SUM iterates over an empty set, returns NULL. How can I make it instead return 0?


#2

Hi,

SELECT IFNULL(SUM(x), 0) FROM `beer-sample` WHERE FALSE;