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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Broblem getting Avrage of date parameter

Re: Broblem getting Avrage of date parameter

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 28 Sep 2006 04:39:15 -0700
Message-ID: <1159443555.054456.194840@k70g2000cwa.googlegroups.com>


Rafael Amar wrote:
> Hello All,
> I have a problem i'll be more then glad if someone can halp me.
> I have a column that containes DATE example: 30/12/1899 00:00:23.
> I need to get the avg run time for the spesific column.
>
> Example:
> I have 2 row in the column that 30/12/1899 00:00:23 and 30/12/1899
> 00:00:25
>
> I need to get the answer 30/12/1899 00:00:24
>
> Thanks,
> Rafael

Average with only two possible values in a single column: (MAX(CLOCK_IN)-MIN(CLOCK_IN))/2+MIN(CLOCK_IN) The above subtracts the small date from the large date, with the result

being a number that represents the number and fraction of days between the two dates. Dividing this number by two and adding it to the small date results in a date that is exactly 1/2 way between the two extremes.


To find the average with more than two possible values in a single column:

AVG(CLOCK_IN-TO_DATE('01/01/1900','MM-DD-YYYY'))+TO_DATE('01/01/1900','MM-DD-YYYY') In the above, an arbitrary date is selected to be subtracted from the column that is to be averaged (CLOCK_IN - '01-JAN-1900'), which results

in a number that represents the number of days between the CLOCK_IN and

the artibrary date. If we then find the average of the number of days and add back in the arbitrary date ('01-JAN-1900') to the result, we are left with the average of the column as a date.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Thu Sep 28 2006 - 06:39:15 CDT

Original text of this message

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