[eluser]kiwimediapro[/eluser]
I have the following query:
Code:
SELECT SUM(t1.totalprice) as totalprice,
SUM(t1.sales) as salessubtotal, t1.`year` as `year`,
t1.mnth as `month`
from
(SELECT
Sum(crm_sales.totalprice) AS totalprice,
MONTHNAME(crm_sales.date) AS mnth,
YEAR(crm_sales.date) AS `year`,
Count(crm_sales.totalprice) AS sales,
MONTH(crm_sales.date) AS `ordering`
FROM `crm_sales`
WHERE `date` BETWEEN '2009-01-01' AND '2010-05-28'
GROUP BY crm_sales.date
) as t1
GROUP BY t1.`year`,t1.mnth
ORDER BY t1.`year`, t1.ordering
This returns the following data:
No_Sales Year Month
---------------------------------------
588 2009 September
660 2009 October
524 2009 November
521 2009 December
609 2010 January
619 2010 February
732 2010 March
605 2010 April
736 2010 May
How do i get this into this into Google stacked column chart so that the Y-axis is No_sales, the x_axis months and the graphs key is the years. So the data is grouped by years.
I have attempted various techniques but just cant seem to nab it. I have the controller,model and view files attached.
Thanks for any help.