I am trying to make a graph that should show a total for each month from the previous year and a total from each month from the current year
I have this MySQL, which can show for e.g. from the year 2020:
SELECT SQL_NO_CACHE YEAR (ticket.create_time) as Y, MONTH (ticket.create_time) as M, COUNT (*) as Total
FROM ticket
INNER JOIN queue ON ticket.queue_id = queue.id
where
(ticket.create_time> = DATE_SUB (NOW (), INTERVAL 2 YEAR)
)
GROUP BY Y, M
HAVING Y = ‘2020’
ORDER BY M DESC
I would like 2 lines to appear in Graph - a line that shows total per. month for both the year 2019 and the year 2020
Is it possible ?