Subject RE: [firebird-support] Sub select paramerter with null value problem
Author Alan McDonald
> Hello,
>
> I just found out that some of my query work wrong. This is query example:
>
> SELECT
> A.Field1,
> sum(A.Field2),
> (SELECT sum(B.Field2) FROM B WHERE B.Field1 = A.Field1)
> FROM A
> GROUP BY A.Field1
>
> When A.Field1 get value NULL and sets it to subselect query,
> subselect query do not
> work correctly (allways returning null result). How to solve this
> problem?

if you're summing a field (or any aggregate function) you should define a
default value 0 NOT NULL for it.
Alan