I'm trying to do a query to count the number of tickets opened on each day
of a month. It'll always be from the 1st to the end of the month. This does
it:
SELECT TO_CHAR(DATE_TRUNC('day',date_opened),'DD') AS day, COUNT(*)
FROM ticket GROUP BY DATE_TRUNC('day', date_opened)
WHERE <date range here>;
But it doesn't give me a zero for the days when no tickets were opened -
which I really need because I want to graph the result.
I could do this in the application code but that doesn't seem right.
Help would be great.
Andrew