Mysql dataset how to format using PHP -
mysql database result set :
department month value sale february 50 sale march 35 sale april 65 sale may 120 dispatch february 85 dispatch march 23 dispatch april 45 dispatch may 33 .... etc
and repeated 4 departments.
i want php format data result looks this:
['month', 'sales', 'dispatch', 'support', 'calibration'], ['february', 50, 85, 15, 53], ['march', 35, 23, 12, 55],
etc
mysql statement:
$sql_line_chart = "select d.department department, monthname(date_created) month, coalesce(sum(case when c.cat_id in (5,6,7,8,9,10,11,12,13,15) time_spent end), 0) value master m inner join category c on c.cat_id = m.cat_id inner join department d on d.dept_id = m.dept_id , date_created > current_date - interval dayofyear(current_date) - 1 day , date_created < current_date - interval dayofyear(current_date) - 1 day + interval 1 year group d.department, month order d.department asc, m.date_created asc";
any appreciated.
Comments
Post a Comment