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

Home -> Community -> Usenet -> c.d.o.server -> Re: GROUP BY DAY.... problem.

Re: GROUP BY DAY.... problem.

From: Svend Jensen <svend.SPAMKILLjensen_at_secret.dk>
Date: Sun, 27 Feb 2005 12:40:28 +0100
Message-ID: <4221b230$0$979$edfadb0f@dread16.news.tele.dk>


rishib4u_at_gmail.com wrote:
> hi everyone,
> i have a query that needs to calculate the AVG of records taken at 15
> minutes interval 24/7 grouped by day for a date range. As per the
> requirements the AVG needs to consider the following guidelines -
> say the the time for which the data has to be avg'd up is 7:00 am to
> 8:00 am then the AVG would be for all data recorded at (7:15, 7:30,
> 7:45 & 8:00) excluding the first record at 7:00 am i.e. > 7:00 AM AND
> <= 8:00 AM.
> NOW the problem is that when i GROUP BY date the AVG function
> calculates the average of all records for that day including the record
> at 0:00 HRS and excluding the record at 24:00 HRS whence it should be
> the exact opposite as per the guidelines.
> Can anyone please suggest a solution?
> thankyou,
> rishi.
>

Take a look at analytic functions.
It's in the DOC's
Goes like:
select columnx, columny, avg(columnz)

   over ( partition by time_column )

/Svend Received on Sun Feb 27 2005 - 05:40:28 CST

Original text of this message

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