From: Chris W  Sent: 07 July 2006 09:23
> 
> 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.

SELECT * FROM t
WHERE TimeCol < DATE_SUB(CURDATE(), INTERVAL 60*60*24*3 SECOND);

http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html

mark
--
 





MARK ADDISON
WEB DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4678
F 
E [EMAIL PROTECTED]
WWW.ITN.CO.UK
Please Note:

 

Any views or opinions are solely those of the author and do not necessarily 
represent 
those of Independent Television News Limited unless specifically stated. 
This email and any files attached are confidential and intended solely for the 
use of the individual
or entity to which they are addressed. 
If you have received this email in error, please notify [EMAIL PROTECTED] 

Please note that to ensure regulatory compliance and for the protection of our 
clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to