Unix Technical Forum

seek select statement to fetch rows older than five minutes

This is a discussion on seek select statement to fetch rows older than five minutes within the DB2 forums, part of the Database Server Software category; --> Ideally I'd like an equivalent of : current date - 5 days which works for minutes instead of days... ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:09 AM
gimme_this_gimme_that@yahoo.com
 
Posts: n/a
Default seek select statement to fetch rows older than five minutes

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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 07:09 AM
Dave Hughes
 
Posts: n/a
Default Re: seek select statement to fetch rows older than five minutes

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.

--

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 07:11 AM
willyunger@gmail.com
 
Posts: n/a
Default Re: seek select statement to fetch rows older than five minutes

or

CURRENT TIME - 5 MINUTES

so you donīt waste column bytes in the whole TIMESTAMP- Of course, you
wonīt have the date, then

Willy

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com