Avg() not including 0's
- From: "lee.richmond" <Richmolj@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 13:18:59 -0800 (PST)
Hi,
I have a sql query like this
select avg([mycolumn]) from data where date > '1/5/08' and date <
'1/10/08'
group by [mycolumn]
order by [mycolumn] desc
If all values within that average are numbers, I'm fine. If it's a 0
(not a null, a 0) it doesn't get averaged in. For instance, values
0,1,2 should produce an average of 1.
(0+1+2)/3 = 1.
But sql is returning a value as if my 0's were nulls and not factored
in:
(1+2)/2 = 1.5
Does anyone know why this is happening and how to fix it?
.
- Follow-Ups:
- Re: Avg() not including 0's
- From: Hugo Kornelis
- Re: Avg() not including 0's
- From: Gert-Jan Strik
- Re: Avg() not including 0's
- Prev by Date: Inserting multiple records into two tables...with a twist
- Next by Date: Re: Inserting multiple records into two tables...with a twist
- Previous by thread: Inserting multiple records into two tables...with a twist
- Next by thread: Re: Avg() not including 0's
- Index(es):
Relevant Pages
|