Subject | Re: Sub select paramerter with null value problem (solution) |
---|---|
Author | jasajona |
Post date | 2005-06-29T15:07:32Z |
SELECT
A.Field1,
sum(A.Field2),
(SELECT sum(B.Field2) FROM B WHERE
(B.Field1 = A.Field1 AND A.Field1 IS NOT NULL) OR
(B.Field1 IS NULL AND A.Field1 IS NULL)
)
FROM A
GROUP BY A.Field1
A.Field1,
sum(A.Field2),
(SELECT sum(B.Field2) FROM B WHERE
(B.Field1 = A.Field1 AND A.Field1 IS NOT NULL) OR
(B.Field1 IS NULL AND A.Field1 IS NULL)
)
FROM A
GROUP BY A.Field1