I've found a few tips here which I used to update my query but I'm still unable to get there: Here's my query:
SELECT PUE.Name, puc.EventID, MONTH(DM.Date) AS Month, DAY(DM.Date) AS Day,
ISNULL(COUNT(puc.consumerdataID),0) AS Count
FROM Day_Map DM
LEFT JOIN PUConsumerData puc ON CONVERT(date,puc.date) = CONVERT(date,DM.Date)
LEFT JOIN PUEvents PUE on PUE.EventID = puc.EventID
WHERE CONVERT(date, DM.Date) >= '2013-10-18'
and CONVERT(date, DM.Date) <= '2013-10-20' and
GROUP BY pue.Name, puc.EventID, MONTH(DM.Date), DAY(DM.Date)
Here's what it returns:
Spring 3574 10 19 178
Spring 3574 10 20 33
Gusse 3575 10 18 5
Gusse 3575 10 19 117
Gusse 3575 10 20 18
Beach 3576 10 18 1
Beach 3576 10 19 133
Beach 3576 10 20 66
What I want it to do is add the zero line for Spring like this:
Spring 3574 10 18 0
I added the Day_Map table with the dates, per another tip I saw but I need to group on the name and not just the date so its not working for me. Other ideas?
Here's the date range is entered for an example but the user uses parameters to put in a custom date range. Thanks.