Subject Re: Sub query returns NULL
Author Moegamat Alexander
Hi

It seems by adding another coalesce seems to do the trick ... question is
why

Sub query

coalesce((select *coalesce(a.CreditSales,0)*
FROM crdsales_v a
where a.salesdate = z.salesdate),0) as CreditSales,



On Mon, May 17, 2010 at 8:55 AM, Moegamat Alexander <moegamat.a@...>wrote:

> Hi
>
> I have a problem in that my subquery returns a null value despite the fact that I have it wrapped in a coalesce ... What am I missing?
>
> Many thanx
>
> /M
>
> SELECT
> z.salesdate,
> sum(w.EXTENDED) SalesTotal,
>
> sum(w.DISCOUNT) Discounts,
>
> (select a.roundloss
> FROM round_v a
> where a.salesdate = z.salesdate) as RoundLoss,
>
> (select *coalesce(a.CreditSales,0)*
> FROM crdsales_v a
> where a.salesdate = z.salesdate) as CreditSales,
>
> ..
> ..
> FROM asales z,sales v,salesitems w,salestype x
> where z.salesdate between :sdate and :edate
> ..
> ..
> group by z.salesdate
>
>


[Non-text portions of this message have been removed]