Woodburn2006 Posted November 20, 2007 Share Posted November 20, 2007 i have a load of news items stored in a db. the time and date is in a field set as DATETIME how would i select just the news from September 2007? Link to comment https://forums.phpfreaks.com/topic/78083-selecting-dates/ Share on other sites More sharing options...
obsidian Posted November 20, 2007 Share Posted November 20, 2007 Try something like this: SELECT * FROM my_table WHERE MONTH(date_col) = 9 AND YEAR(date_col) = 2007 You could also do something like this: SELECT * FROM my_table WHERE date_col BETWEEN '2007-11-01' AND '2007-11-30' Link to comment https://forums.phpfreaks.com/topic/78083-selecting-dates/#findComment-395180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.