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 Quote 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) Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.