SOLVED

Inserting empty rows

Copper Contributor

This should be simple, but my SQL skills are rusty.  I have a query that extracts the year and a count of incidents from  a table.

SELECT year, Count(year) AS incidents
FROM Table2
WHERE ((Table2.cause_ID=15) OR (Table2.cause_ID=16))
GROUP BY year;

 

Of course, many years have no matching cause_ID = 15 or 16.  I would like an output of year and 0 for those years.

20 Replies
Excellent.