RE: [PHP-DB] MySql and displaying only yesterday's records
| From: | John W. Holmes | Date: | Mon, 21 Oct 2002 12:45:19 +0000 |
| Subject: | RE: [PHP-DB] MySql and displaying only yesterday's records | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22546@lists.php.net to get a copy of this message | ||
> Given a datetime field in a MySql database, how can i list all the
records
> that are dated back to yesterday or to 'N' days in the past?
SELECT * FROM your_table WHERE TO_DAYS(date_column) =
TO_DAYS(CURRENT_DATE) - N
Where N is how many days you want to go back.
---John Holmes...