Subject [firebird-support] Re: i want to this ; select avg(datefield) from ... but what?
Author Svein Erling Tysvaer
Is the field defined as DATE or CHAR? It might just be that we have
different Firebird versions (I think I'm running Firebird 2.1 on this
computer), but I get 'Dynamic SQL Error expression evaluation not


Orhan TURHAN wrote:
> my sql is "select avg(datefield) from table"
> error is:
> Overflow occurred during data type conversion.
> conversion error from string "2008-01-01".

I wrote:

Doing avg on a datefield may not work, but datefield-date should return
a number and number + date return a date, so that maybe something like

SELECT avg(datefield - cast('1.1.1980' as date)) +
cast('1.1.1980' as date)
from datetable

is what you want?


Anderson Farias wrote:
> Hi,
>> i want to this ; select avg(datefield) from ... but what?
> AVG is defined by the SUM of element values divided by the number of
elements... so, how's that suposed to work on date fields?
> Tell exactly what [input -> result value] you wish and maybe someone
comes up with a solution.
> Regards,
> Anderson Farias

[Non-text portions of this message have been removed]