Odhiambo, 

Give this a try,

DELETE from relay_ip where UNIX_TIMESTAMP(rei_ts) <
(UNIX_TIMESTAMP(NOW()) - (10 * 60));

Eric Mayers
Software Engineer
Captus Networks


> -----Original Message-----
> From: Odhiambo Washington [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 10, 2002 11:22 PM
> To: [EMAIL PROTECTED]
> Subject: Clear table contents
> 
> 
> Hello gurus,
> 
> 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.
> 
> 
> tia
> 
> 
> -Wash
> 
> S y s t e m s   A d m i n.
> 
> -- 
> Odhiambo Washington  <[EMAIL PROTECTED]>    "The box said 'Requires
> Wananchi Online Ltd.  www.wananchi.com      Windows 95, NT, 
> or better,'
> Tel: 254 2 313985-9   Fax: 254 2 313922     so I installed 
> FreeBSD."   
> GSM: 254 72 743 223   GSM: 254 733 744 121  This sig is McQ!  :-)
> 
> ++
> No problem is so formidable that you can't just walk away from it.
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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

Reply via email to