Hi All,
I have a head bleeder and need some guidance from an SQL brainiac…!
I have a chart, works fine, but only shows the months that have data, looks like this (I know the ordering is off, this has been sorted):
The data is coming from a table join with a ‘months’ table (id name):
and an archive table that lists our data (MariaDB/MySQL) from the ‘DateUpdated’ field.
So… I’ve joined the months table to the archive table and this works but it really should show all months, even if they have zero data. I’ve tried every iteration of the SQL and cant get the ‘empty’ months to show on that chart - can someone take a look for me please?
Heres my working SQL statement:
SELECT months.id AS X, COUNT(*) AS Y
FROM months
LEFT JOIN thearchive ON months.id = MONTH(DateUpdated)
WHERE YEAR(DateUpdated) = '2023'
AND CID = '12233'
GROUP BY months.id;