Prevent SUM() for returning NULL

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

Hi,

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

1 Like