Re: old news SQL help needed
| From: | Dobromir Velev | Date: | Mon, 01 Oct 2001 08:27:36 +0000 |
| Subject: | Re: old news SQL help needed | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-12862@lists.php.net to get a copy of this message | ||
Hi,
You shoud use DELETE FROM leagues WHERE TO_DAYS(NOW()) - TO_DAYS(news_date)
>= 7
The problem is that you entered league_news between DELETE and FROM.
HTH
Dobromir Velev
-----Original Message-----
From: Larry Linthicum <larry@kimshew.com>
To: php-db@lists.php.net <php-db@lists.php.net>
Date: Sunday, September 30, 2001 4:24 AM
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
>
>