Subject | RE: [firebird-support] Re: i want to this ; select avg(datefield) from ... but what? |
---|---|
Author | ICAMSoft |
Post date | 2008-05-21T15:58:15Z |
Maybe the answer is to find the average diff from a (fixed) date as start point and afterwards add the avg to this fix date
At least the following worked (fb SS v.2) and gave meaningfull result
select
cast(avg((MO_DATE - cast('1980/01/01' as date))) as integer)
+ cast('1980/01/01' as date)
from T_MOVES
Best regards
A.Kyriakos
Athens, Greece
________________________________________
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Orhan TURHAN
Sent: Tuesday, May 20, 2008 11:22 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: i want to this ; select avg(datefield) from ... but what?
my sql is "select avg(datefield) from table"
error is:
Overflow occurred during data type conversion.
conversion error from string "2008-01-01".
At least the following worked (fb SS v.2) and gave meaningfull result
select
cast(avg((MO_DATE - cast('1980/01/01' as date))) as integer)
+ cast('1980/01/01' as date)
from T_MOVES
Best regards
A.Kyriakos
Athens, Greece
________________________________________
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Orhan TURHAN
Sent: Tuesday, May 20, 2008 11:22 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: i want to this ; select avg(datefield) from ... but what?
my sql is "select avg(datefield) from table"
error is:
Overflow occurred during data type conversion.
conversion error from string "2008-01-01".