1

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?

Erik Åsland
  • 9,542
  • 10
  • 30
  • 58
  • Possible duplicate of [MySQL MONTHNAME() from numbers](http://stackoverflow.com/questions/7027129/mysql-monthname-from-numbers) – sgeddes Oct 30 '15 at 23:26

1 Answers1

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

Shan Robertson
  • 2,742
  • 3
  • 25
  • 43