Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2006

Tip: Looking for answers? Try searching our database.

seek select statement to fetch rows older than five minutes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gimme_this_gimme_that@yahoo.com - 25 May 2006 01:17 GMT
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.
Dave Hughes - 25 May 2006 03:25 GMT
> Ideally I'd like an equivalent of :
>
[quoted text clipped - 8 lines]
>
> 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.
willyunger@gmail.com - 30 May 2006 17:00 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.