I have a query that simply counts how many items exist for a particular status within a given data range. The query works...
The sorta problem is that it only returns rows for a given date where at least one of the counts exists. Can I get it to return all dates within the range provided with values of 0, 0?
Code:
SELECT DATE(MY_TIMESTAMP) AS DATE,
SUM(CASE WHEN STATUS_ID=10 THEN 1 ELSE 0 END) AS STATUS10,
SUM(CASE WHEN STATUS_ID=20 THEN 1 ELSE 0 END) AS STATUS20
FROM "MYDBB"."TABLE0"
WHERE
DATE(TIMESTAMP) >= DATE('2011-12-11') AND
DATE(TIMESTAMP) <= DATE('2011-12-17')
GROUP BY DATE(MY_TIMESTAMP);
The sorta problem is that it only returns rows for a given date where at least one of the counts exists. Can I get it to return all dates within the range provided with values of 0, 0?