Re: Complex SQL
Date: Fri, 25 Oct 2002 12:43:23 -0700
Message-ID: <apc6sb$jki$1_at_spiney.sierra.com>
select trunc(the_date) the_date,
avg(the_numeric_value) the_average_value
from the_table
I'm sure that you are aware that this is covered in the Oracle
documentation,
"Jim" <jschneider_at_kjinteractive.com> wrote in message
news:8e6a91e3.0210250837.57983b3b_at_posting.google.com...
group by trunc(the_date)
but like many of us, you are too lazy to look it up.
> Maybe not so complex, but I don't know how to do it.
>
> My table is setup like this:
>
> Date Numeric Value
> -------------- --------------
> 01/02/2002 10
> 01/03/2002 17
> 01/04/2002 83
> ....
>
> What I'd like to do is to get the average (AVG) of
> the "Numeric Value" column at each date interval, with a
> single SQL statement. That is, an SQL statement that
> returns:
>
> 01/02/2002 10
> 01/03/2002 13.5 [(10 + 17)/2]
> 01/04/2002 55 [(10 + 17 + 83)/3]
>
> Thanks in advance for any help.
Received on Fri Oct 25 2002 - 21:43:23 CEST