473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.

May 25 '06 #1
2 10045
gi*******************@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.

--

May 25 '06 #2
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

May 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ralph Freshour | last post by:
I have a question about the following PHP script - I got it off a web site tutorial on how to count users logged into your site - my question is the $PHP_SELF variable - it writes the name of the...
2
by: ghasem | last post by:
Dear mySQL community, I have once again turned to the user groups for a problem I cannot solve myself! Atually, I have read all I can from the newsgroups on this but I could not solve it myself....
3
by: dror | last post by:
Hello, I have a problem that actually doesn't even make sense. I have 4 million rows in my database. I want to get all records into a DataReader and then read. So if I do it in DAO (either in VB...
10
by: AC Slater | last post by:
I have 1 table (out of many) that has very poor performance when performing a select into on. The select statement is called multiple times. We've found each call to take almost 1 second... we...
12
by: TP | last post by:
Here is my problem. I need to display a table about which I have no information except the table name. Using metadata I can somehow show the column names and record values. But my table has 1...
1
by: BF | last post by:
Hello, I am trying to find out if there is a way to limit the number of rows returned when a cursor is opened. I am using DB2 version 7 on z/OS. The SELECT statement in my DECLARE CURSOR...
3
by: taru | last post by:
Env: DB2 UDB 8.1 on AIX We are executing a db2 sql stored procedure which is invoked from a java client. The stored procedure contains few select, insert and update statements. Using the DB2...
8
by: carlospedr | last post by:
I have to insert data from about 30 tables into a single table (Users), to do so i used a cursor and a bit of dynamic sql, this should work fine if the tables have to do the select from had the...
59
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.