Results 1 to 1 of 1
Mar 4, 2005, 07:47 #1
- Join Date
- Dec 2004
- 0 Post(s)
- 0 Thread(s)
cross-tab query - how can I force an "0" results where there is nothing to total
I'm using the cross-tab query below. It gives me what I want except where there are no calls for January, it skips that month. I want to run a query that forces a result for January even if there are no records that meet that criteria.
Any ideas? Your help is MUCH appreicated!
SELECT DATE_FORMAT(date_call, '%Y') as year_name,
DATE_FORMAT(date_call, '%M') as month_name, COUNT(CASE WHEN returned = 'Y' THEN call_id ELSE NULL END) AS 'returned'
GROUP BY month_name, year_name
ORDER BY YEAR(date_call) ASC, MONTH(date_call) ASC