Subject Re: Days since timestamp
Author Adam
--- In firebird-support@yahoogroups.com, "Nigel Weeks" <nweeks@...>
wrote:
>
> I'm pulling out my hair here...(what's left, anyway...)
>
> Table:
> CREATE TABLE tbl_event (
> int_event INTEGER NOT NULL,
> dtm_stamp TIMESTAMP,
> PRIMARY KEY(int_event)
> );
>
> How do I work out how many days(relative to 'now') it's been since
an event
> happened?
> I've got 7 levels of parenthesis and casts/extracts, and I'm getting
> grumpy!!!
>

What on earth are you trying?

select
cast((cast('now' as TimeStamp) - dtm_stamp) as integer) as NumDays
from tbl_event
where .....