[thelist] mySQL query

Anthony Baratta Anthony at Baratta.com
Thu Apr 1 17:08:10 CST 2004


At 02:51 PM 4/1/2004, Mark Joslyn wrote:
>I want to grab some headlines from my mySQL database that fall between a
>certain date range
>
>my date field is set up YYYY-MM-DD. I would like to extract the headlines
>that fall between today and 30 days ago.

http://www.mysql.com/doc/en/Date_and_time_functions.html

SELECT something FROM tbl_name
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;



More information about the thelist mailing list