Subject Re: [firebird-support] view and computation
Author Markus Ostenried
On Wed, Jul 31, 2013 at 9:31 AM, Olaf Kluge <olaf.kluge@...> wrote:

> **
> Hello,
>
>
> in a view, the following expression is possible :
> .(a.eingangsdatum+coalesce(c.zahldauer,0)) as FAE,.
>
> But how can I take the current date in relation? For example:
>
> cast((current_date - (a.eingangsdatum+coalesce(c.zahldauer,0))) as integer)
> as FIN
>
> I would like to calculate when the payment will be due.
>

You are trying to subtract a date from another date. Not sure if they like
that :)
Have a look at DATEDIFF function:
http://www.firebirdsql.org/refdocs/langrefupd25-intfunc-datediff.html

There's also DATEADD if you want to add some other unit than day to a date:
http://www.firebirdsql.org/refdocs/langrefupd21-intfunc-dateadd.html

HTH,
Markus


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