Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: add or avg with null values


Message #1 by "Neetu Dhatt" <neetu_dhatt@h...> on Wed, 22 Jan 2003 06:01:00 +0000
Hi guys
I am trying to get the total sum or avg for a column (asp)but some of the values of that column are null, so now i can't add the
column values accurately.  Does anyone know how to get around that and be able to calculate the total sum or avg accurately.  Any
help is appreciated
THanksMSN 8 helps  ELIMINATE E-MAIL VIRUSES.  Get 2 months FREE*. 
Message #2 by "Jonas Skafte Jensen" <jonaxfora@h...> on Wed, 22 Jan 2003 08:44:01 +0100
Depending on how (/ whether) you want to calculate the NULL-values, you can
either do this:

SELECT AVG(column) WHERE column IS NOT NULL

which will disregard the rows containing NULL-values, or this:

SELECT AVG(ISNULL(column, 0))

which will calculate rows containing NULL-values as zero.

----- Original Message -----
From: "Neetu Dhatt" <neetu_dhatt@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, January 22, 2003 7:01 AM
Subject: [asp_databases] add or avg with null values


>
> Hi guys
> I am trying to get the total sum or avg for a column (asp)but some of the
values of that column are null, so now i can't add the column values
accurately. Does anyone know how to get around that and be able to calculate
the total sum or avg accurately. Any help is appreciated
> THanksMSN 8 helps  ELIMINATE E-MAIL VIRUSES.  Get 2 months FREE*.
>
>

  Return to Index