bschultz Posted April 30, 2008 Share Posted April 30, 2008 I'm trying to select only records from the month of March. I've tried... $sql = "SELECT date, title, text FROM table ORDER by date DESC WHERE `date` = DATE_SUB(CURDATE(),INTERVAL -2 month)"; and this... $sql = "SELECT date, title, text FROM brian ORDER by date DESC WHERE `date` BETWEEN DATE_SUB(CURDATE( ) ,INTERVAL -2 MONTH) AND CURDATE( )"; Neither are working. Can anyone help, please? Quote Link to comment Share on other sites More sharing options...
bschultz Posted April 30, 2008 Author Share Posted April 30, 2008 this code works $sql = "SELECT date_col, title, text FROM brian WHERE date_col BETWEEN '2008-04-01' AND '2008-05-01' order by date_col desc"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.