|
Posted by Gordon Burditt on 05/06/07 03:00
>I had queries stored in mysql database according to queries
>publication date (in format 2007-5-6, 2007-4-30 etc.). However, i
>would like to implement automatic expired queries deletion after 6
>months. For instance, 2007-4-30 released bulletin will be deleted
>after it expired 6 months later. How do I peform this?
DELETE FROM publications WHERE pubdate < subdate(now(), INTERVAL 6 MONTH);
This presumes that pubdate is a DATE or DATETIME column, or can be
converted to one (say, with strtotime()).
Run this query using the mysql command-line utility from cron or some
regularly scheduled job, daily or weekly or whatever.
Navigation:
[Reply to this message]
|