|
Posted by Andy Jeffries on 06/22/06 10:32
On Thu, 22 Jun 2006 03:03:29 -0700, monomaniac21 wrote:
> can you write a mysql qery to retrieve all rows from a table where the
> date collumn is equal to a value (date) from now to 30 days ago?
SELECT *
FROM my_table
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= my_date_column;
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
Navigation:
[Reply to this message]
|