You are here: Re: mysql query to get rec's created in last 30 days « PHP Programming Language « IT news, forums, messages
Re: mysql query to get rec's created in last 30 days

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация