You are here: Re: delete expired queries « PHP Programming Language « IT news, forums, messages
Re: delete expired queries

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация