Hi everybodies,
I’m start with Metabase and sorry if someone has already asked this question.
I have a simple query like that :
“SELECT sum(sales_cr_memo_lines_month
.line_amount
) AS sum
FROM sales_cr_memo_lines_month
WHERE…”
And I want to return 0 when my query don’t have result, but i don’t find how to do that.
Is-it possible?
Thanks
Hi @christophe
Depending on your database, you can probably use IFNULL()
like:
SELECT IFNULL(SUM(sales_cr_memo_lines_month.line_amount), 0) AS sum
...
For general SQL questions, you’ll likely find better answers on stackoverflow.com or a forum dedicated to the database you’re using.
thanks a lot, it’s perfect