Hello all,
SELECT a.secondary as Category, SUM(case when w.date between '2010-08-14' AND '2010-08-20' then h.value else 0 end) as year2007, SUM(case when w.date between '2010-08-07' AND '2010-08-13' then h.value else 0 end) as year2008, SUM(case when w.date between '2010-07-31' AND '2010-08-06' then h.value else 0 end) as year2009, SUM(case when w.date between '2010-07-24' AND '2010-07-30' then h.value else 0 end) as year2010 FROM activity_categories a JOIN hp_activities h on a.categoryId = h.categoryId JOIN workdays w on w.workdaysId = h.workdaysId JOIN personnel p on w.personnelId = p.personnelId WHERE a.primaryCategory='Violations' GROUP BY Category ORDER By year2007
I am using the above query to generate data for a multi-stacked 3Dchart. But when I use
addDatasetsFromDatabase($result1, "Category","year2008");
now the issue is that I am not able to generate all the columns for the chart. Moreover I can't repeat the function addDatasetsFromDatabase($result1, "Category","year2007") for 2007 , 2009,2010.
So how do I tell it to plot all the coulms and not just one.
Please help!!!:crying: