The INTERVAL command is what you are looking for. It doesn't have to be SECOND
(with no S), you could use day, hour ,week, etc.
SELECT * FROM t WHERE TimeCol<(now() - INTERVAL X SECOND)
http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html
----- Original Message -----
From: "Chris W" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Friday, July 07, 2006 4:23 AM
Subject: Date functions
It's late and I just gave up reading the manual. Can someone please
tell me the easiest way to do a query that will return all rows with a
time stamp that is X number of seconds older than the current time?
Something like this.....
SELECT * FROM t
WHERE TimeCol < (now() - 60*60*24*3)
Yes I know that is just 3 days but other times I will want to find
records that are a few hours old so I like using the formula.
--
Chris W
KE5GIX
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
One stop wish list for any gift,
from anywhere, for any occasion!
http://thewishzone.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]