Re: Averaging dates

From: Andy Triggs <andrew.triggs_at_businessobjects.com>
Date: 17 Jul 2002 02:58:39 -0700
Message-ID: <2b6e86d0.0207170158.78318d2_at_posting.google.com>


I'm not entirely sure how useful the answer will be, but you could do it by converting the date to julian format as avg() will only operate on numeric arguments:

SELECT to_date(avg(to_number(to_char(hiredate, 'J'))), 'J') FROM employee;

Regards, Andy

"Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message news:<tl6Z8.64246$uw.35157_at_rwcrnsc51.ops.asp.att.net>...
> What the heck is the average of a series of dates?
> Sounds like you are trying to average a series of colors.
> Do you mean what is the average number days from now?
> eg select avg(sysdate-hiredate) from employee
> Jim
> "Ron Gardiner" <rongardiner_at_shaw.ca> wrote in message
> news:WB4Z8.61099$BD1.5521513_at_news1.calgary.shaw.ca...
> > Hope someone can help...
> >
> > How do I average a column of datatype date?
> >
> > SELECT AVG(HIREDATE) FROM EMPLOYEE; doesn't work.
> >
> > TIA!
> >
> >
> >
Received on Wed Jul 17 2002 - 11:58:39 CEST

Original text of this message