View Full Version : Handling NULL values


gekseppe
12-04-2008, 02:18 AM
Hello everybody.

I have the following query:

SELECT DISTINCTROW BB_Registration.BB_Colli_Discharged, Sum(BB_Deliverying.Deliverying_OfColli) AS [Somma Di Deliverying_OfColli]
FROM BB_Registration INNER JOIN BB_Deliverying ON BB_Registration.BB_id = BB_Deliverying.BB_id
GROUP BY BB_Registration.BB_Colli_Discharged;

In some scenarios 'Sum(BB_Deliverying.Deliverying_OfColli) ' is a NULL value: this prevents to retrieve by the query all the values in the tables.

Is there a way to handle this ?

Many thanks for any suggestion !

KenHigg
12-04-2008, 03:10 AM
Maybe something like the following will help:

Sum(nz(BB_Deliverying.Deliverying_OfColli))

???

gekseppe
12-04-2008, 04:36 AM
Nothing...

I also tried the following:

SELECT BB_Registration.BB_Colli_Discharged,
Sum(Nz([BB_Deliverying.Deliverying_OfColli], 0)) AS SumOfDeliverying_OfColli
FROM BB_Registration INNER JOIN
BB_Deliverying ON BB_Registration.BB_id=BB_Deliverying.BB_id
GROUP BY BB_Registration.BB_Colli_Discharged

but problem not fixed yet :mad: