Subject Re: [firebird-support] i want to this ; select avg(datefield) from ... but what?
Author Svein Erling Tysvaer
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?

HTH,
Set

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