gimme_this_gimme_that@yahoo.com wrote:
> Ideally I'd like an equivalent of :
>
> current date - 5 days
>
> which works for minutes instead of days...
>
> ---
>
> But, assuming I have a table with a timestamp column named
> modified_date , how can I select rows older then 5 minutes?
>
> Thanks.
You're gonna kick yourself for this one :-) Try:
modified_date < CURRENT TIMESTAMP - 5 MINUTES
Or for rows modified in the last 5 minutes:
modified_date >= CURRENT TIMESTAMP - 5 MINUTES
Have a look at the "labeled_duration" section of the DB2 documentation
on this page:
http://tinyurl.com/e6su8
You can use suffixes of YEAR(S), MONTH(S), DAY(S), HOUR(S), MINUTE(S),
SECOND(S) and MICROSECOND(S) with a constant or expression to make them
into a duration that can be added or subtracted to/from a DATE, TIME or
TIMESTAMP value.
HTH,
Dave.
--