esport Posted March 4, 2009 Share Posted March 4, 2009 Hi guys, I have a table that has a date field. I was wondering how to group the set of dates by month. Thanks Daniel Link to comment https://forums.phpfreaks.com/topic/147981-solved-grouping-dates-by-month/ Share on other sites More sharing options...
rhodesa Posted March 4, 2009 Share Posted March 4, 2009 assuming the field is called 'mydate': SELECT YEAR(mydate),MONTH(mydate),COUNT(*) FROM tablename GROUP BY YEAR(mydate),MONTH(mydate) Link to comment https://forums.phpfreaks.com/topic/147981-solved-grouping-dates-by-month/#findComment-776671 Share on other sites More sharing options...
esport Posted March 8, 2009 Author Share Posted March 8, 2009 Thanks mate, worked a treat. Daniel Link to comment https://forums.phpfreaks.com/topic/147981-solved-grouping-dates-by-month/#findComment-779388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.