Hello Odhiambo, > Please allow me to request for help with the table below. > mysql> select * from relay_ip; > >+---------+--------------------+------------------------+-------------+---------------------+ > | rei_aid | rei_uname | rei_domain | rei_ip | rei_ts > | > >+---------+--------------------+------------------------+-------------+---------------------+ > | 1 | wash | alligator.wananchi.com | 62.8.64.4 | 2002-02-08 >18:17:36 | > | 2 | wash | alligator.wananchi.com | 62.8.64.108 | 2002-02-08 >20:36:51 | > | 3 | wash | alligator.wananchi.com | 62.8.64.108 | 2002-02-08 >20:42:27 | > | 4 | wash | alligator.wananchi.com | 62.8.64.108 | 2002-02-09 >13:03:27 | > | 5 | wash | alligator.wananchi.com | 62.8.64.108 | 2002-02-09 >13:03:28 | > | 6 | [EMAIL PROTECTED] | freebsd.co.ke | 62.8.64.108 | 2002-02-11 >09:46:43 | > | 7 | [EMAIL PROTECTED] | freebsd.co.ke | 62.8.64.108 | 2002-02-11 >09:47:27 | > >+---------+--------------------+------------------------+-------------+---------------------+ > > I am looking for a way to clear each record that is older than 10 minutes by >referring to the > timestamp. Something that I can run from cron.
There is an extensive collection of useful routines described in the manual (6.3.4 Date and Time Functions). You will probably be interested in CURRENT_TIMESTAMP and DATE_SUB(). Currently you have rei_ts formatted as a string. If it is mostly used for calculation, then you might like to consider using (manual: TIME data types) using an integer format or even a UNIX timestamp - for efficiency. Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php