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? Link to comment https://forums.phpfreaks.com/topic/103503-solved-select-from-a-certain-month/ 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"; Link to comment https://forums.phpfreaks.com/topic/103503-solved-select-from-a-certain-month/#findComment-530372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.