RE: MySql and displaying only yesterday's records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux