I have a query that counts the people hired, and it displays correctly as a single bar, and a second query that displays the people who left in the second query. I have a second table that only has a calendar (datefield for each day to 2050) How do I represent both of these in a single bar chart that displays months that had zero values?
People hired (first dataset)
Code: |
SELECT
CONCAT(year(calendar.datefield),'-', LPAD(month(calendar.datefield), 2, '0')) AS Periodo,
IFNULL(count(con_inizio_contratto),0) AS `<font color="blue">Assunzioni</font>`,
FROM datipersonali RIGHT JOIN calendar ON (DATE(datipersonali.con_inizio_contratto) = calendar.datefield)
WHERE YEAR(calendar.datefield) = {$REQUEST:chartYearStart|empty:'2011'}
GROUP BY year(calendar.datefield), month(calendar.datefield), Periodo
|
People who left (second dataset)
Code: |
SELECT
CONCAT(year(calendar.datefield),'-', LPAD(month(calendar.datefield), 2, '0')) AS Periodo,
IFNULL(count(con_licenziamento_data),0) AS `<font color="red">Licenziamenti</font>`,
FROM datipersonali RIGHT JOIN calendar ON (DATE(datipersonali.con_inizio_contratto) = calendar.datefield)
WHERE YEAR(calendar.datefield) = {$REQUEST:chartYearStart|empty:'2011'}
GROUP BY year(calendar.datefield), month(calendar.datefield), Periodo
|