Subject | [firebird-support] Re: i want to this ; select avg(datefield) from ... but what? |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2008-05-20T20:42:23Z |
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
supported'.
Set
Orhan TURHAN 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?
HTH,
Set
Anderson Farias wrote:
different Firebird versions (I think I'm running Firebird 2.1 on this
computer), but I get 'Dynamic SQL Error expression evaluation not
supported'.
Set
Orhan TURHAN wrote:
> my sql is "select avg(datefield) from table"I wrote:
>
> error is:
> Overflow occurred during data type conversion.
> conversion error from string "2008-01-01".
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,elements... so, how's that suposed to work on date fields?
>
>> i want to this ; select avg(datefield) from ... but what?
>
> AVG is defined by the SUM of element values divided by the number of
>comes up with a solution.
> Tell exactly what [input -> result value] you wish and maybe someone
>[Non-text portions of this message have been removed]
>
> Regards,
> Anderson Farias