Subject Re: [firebird-support] putting zero value on null field in select sql
Author Milan Babuskov
James wrote:
> I have a sql like this
> select m.ID, m."Expense", m."SubExpense", (d."TotalAmount" *
> (1-(d."Discount"*0.01)) * (1-(d."Discount2"*0.01)) *
> (1-(d."Discount3"*0.01)) - d."Less" - d."Adjustment") as "GrandTotal"
> from "expensesubtype" m left join "invoice" d on m.ID = d."ExpenseCategory"
> What happen is if I have no record in the invoice table that mathes in
> the expensesubtype the "GrandTotal" is null. How do I replace the null
> with zero? Iam trying to avoid using SP

I'm using Z() UDF from rfunc library for this.

Milan Babuskov