* [EMAIL PROTECTED]
>  I have a table of records using timestamp(14) as a field and need to
> remove any records that are 60 days past the timestamp. I've looked at the
> manual and can't find anything relating on doing this. What query would I
> need to run on the database?

To remove records, use the DELETE command:

<URL: http://www.mysql.com/doc/en/DELETE.html >

To remove records that are more than 60 days old:

DELETE FROM table WHERE timestamp_field < NOW() - INTERVAL 60 DAY;

This syntax is valid for version 3.23 and later, for version 3.22 you need
to use something like this:

DELETE FROM table WHERE timestamp_field < DATE_SUB(NOW(),INTERVAL 60 DAY);

The NOW() function returns the current timestamp. There are many other
usefull date and time functions available, see the manual:

<URL: http://www.mysql.com/doc/en/Date_and_time_functions.html >

--
Roger


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