New User, Need help with Count Query

mccsean01

New member
Local time
Today, 15:31
Joined
Nov 30, 2007
Messages
1
I may be making this more difficult than I need to, but here is the situation. I am trying to create a query that counts total records that fit a specific criteria, but I would also like it to display a 0 if there is no criteria to count. The following is an example of one of these queries:

SELECT Count(*) AS [Total DialsAnsweringMachine], dbo_AODCallDetail.Service_Id
FROM dbo_AODCallDetail
WHERE (((Year([CallStartDt])*12+DatePart("m",[CallStartDt]))=Year(Date())*12+DatePart("m",Date())-1) AND ((dbo_AODCallDetail.SwitchDispId) In (3)))
GROUP BY dbo_AODCallDetail.Service_Id;

As you can see, I am grouping by dbo_AODCallDetail.Service_Id, but when I run the query it only shows be the IDs that have results based on the criteria. I want it to show me all of the counts, even if the count = 0.

Thank you for the help.
 

Users who are viewing this thread

Back
Top Bottom