Re: old news SQL help needed
| From: | Sheridan Saint-Michel | Date: | Mon, 01 Oct 2001 14:15:30 +0000 |
| Subject: | Re: old news SQL help needed | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12868@lists.php.net to get a copy of this message | ||
Try this instead:
Delete league_news FROM leagues
where news_date + interval 7 day <= now();
Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com
----- Original Message -----
From: "Larry Linthicum" <larry@kimshew.com>
To: <php-db@lists.php.net>
Sent: Saturday, September 29, 2001 8:26 PM
Subject: [PHP-DB] old news SQL help needed
> I have a MySql table for news on the site
> the date the news is inserted goes in column news_date
> the text of the news itself, goes in column league_news
>
>
> I want to DELETE all news older than 7 days
> I looked in the MySql documentation at the date functions and tried the
> following but it produced an error ...help?
>
>
> Delete league_news
> FROM leagues
> WHERE TO_DAYS(NOW()) - TO_DAYS(news_date) >= 7
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net