Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Averaging a value except when 0

Re: Averaging a value except when 0

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: 2000/05/09
Message-ID: <8f937b$f3s$1@soap.pipex.net>#1/1

Hi

In you current setup use where score != 0 to exclude 0's. However Also look at the use of null values.

--
Niall Litchfield
Oracle DBA
Audit Commission UK
"Steven Reid" <macreid_at_primus.com.au> wrote in message
news:3914d2c3_at_news.iprimus.com.au...

> Hi,
>
> I have a database that records the score that a student has received for a
> test.
> A value of 0 has been used to signify that that student did not do that
> test.
>
> What I am trying to do is get averages of both the overall and the
> individual.
> So if a zero has been entered, do not use it for the averaging but I still
> need to keep it in the database for reporting purposes.
>
> I am using Oracle 8.0.5 and VB to access the database.
>
> Student_Number Question Score date
> 1 1 0 1/1/00
> 1 2 5 1/1/00
> 2 1 3 1/1/00
> 2 2 5 1/1/00
> 1 1 3 2/1/00
> 1 2 4 2/1/00
> 2 1 4 2/1/00
> 2 2 4 2/1/00
>
> What I want is to be able to get the following:
>
> Date Question Rating
> Overall 1/1/00 1 3
> 2 5
> Individual 1 1/1/00 1 0
> 2 5
> etc.
>
> Overall All Dates 1 3.33
> 2 4.5
> Indivual 1 All Dates 1 3
> 2 4.5
>
>
> Any help VERY MUCH appreciated.
>
> Steve
>
>
>
>
Received on Tue May 09 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US