Subject | Re: [firebird-support] sum and the 'iif' operator |
---|---|
Author | Helen Borrie |
Post date | 2009-11-30T04:14:39Z |
At 02:14 PM 30/11/2009, you wrote:
iif ( ( ( ( cast('now' as timestamp) ) - dtm_stamp ) < 30), flt_amount,0 )
You might or might not need the cast but you do need to bracket the expression.
But you shouldn't need the 'now' value for an evaluation in days - why not just use CURRENT_TIMESTAMP?
iif ( ( (CURRENT_TIMESTAMP - dtm_stamp) < 30), flt_amount,0)
Thought about a view?
./helen
>Hi all,Try
>
>
>
>Trying to do some simple aged balances on a transaction table, and having
>issues.
>
>
>
>Can anyone see what I'm doing wrong?
>
>
>SQL Command:
>
>select int_contactid,
>
>sum(
>
> iif(('now' - dtm_stamp < 30), flt_amount,0)
>Dynamic SQL Error expression evaluation not supported
iif ( ( ( ( cast('now' as timestamp) ) - dtm_stamp ) < 30), flt_amount,0 )
You might or might not need the cast but you do need to bracket the expression.
But you shouldn't need the 'now' value for an evaluation in days - why not just use CURRENT_TIMESTAMP?
iif ( ( (CURRENT_TIMESTAMP - dtm_stamp) < 30), flt_amount,0)
>Any ideas?Subqueries aren't needed, are they?
>
>How do other people do aged balances, apart from individual queries /
>subselects for each range...
Thought about a view?
./helen