MySQL: How To Show Month By Name, Not Number

时间:2015-10-30 23:23:43

标签: mysql

I am currently trying to show the number of site leads per month. I am currently succeeding in most of that task, but I am unable to put the finishing touches on it. I need it to look like this... I my work currently looks like this... My code is as follows... SELECT CONCAT(clients.first_name, " ", clients.last_name) AS name, COUNT(leads.leads_id) as total_leads, MONTH(leads.registered_datetime) FROM clients JOIN sites ON clients.client_id = sites.site_id JOIN leads ON sites.site_id = leads.site_id WHERE leads.registered_datetime BETWEEN '2011-01-01' AND '2011-06-31' GROUP BY leads.registered_datetime I need for the month to be shown as "January" and "February" rather than "1" and "2". What am I doing wrong?

1 个答案:

答案 0 :(得分:2)

You are close, you can simply use the MONTHNAME function in the same manner. http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_monthname
相关问题