Mr Chris Posted August 28, 2008 Share Posted August 28, 2008 Hi All, I have a query which outputs a count of months SELECT MONTH(published) as the_month, COUNT(*) AS total FROM cfm_stories WHERE YEAR(published) = YEAR(NOW()) GROUP BY MONTH(published) LIMIT 1,6 But how do I force a column to be created with the month name. IE at the moment Febuary's value for the_month is 2, March is 3 etc... Thanks Link to comment https://forums.phpfreaks.com/topic/121702-months-in-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2008 Share Posted August 28, 2008 See the mysql DATE_FORMAT() function. A %M format parameter would give the month name. Link to comment https://forums.phpfreaks.com/topic/121702-months-in-mysql/#findComment-627808 Share on other sites More sharing options...
Barand Posted August 30, 2008 Share Posted August 30, 2008 as will SELECT MONTHNAME(published) Link to comment https://forums.phpfreaks.com/topic/121702-months-in-mysql/#findComment-629994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.