troubleshooting Question

Count records including rows that add up to Zero (Nz function?)

Avatar of Ludique
LudiqueFlag for United Kingdom of Great Britain and Northern Ireland asked on
SQL
15 Comments1 Solution348 ViewsLast Modified:
The query below adds up how may policies have been submitted per business origin.  e.g. Referral, Repeat Customer, Advert.

I would like to include all Policy Origins even if the result is Zero.

I've been searching solutions in ee and kinda think that I need Nz somewhere in the SQL but after several experiments can't figure out where to put it.
PARAMETERS [Enter Start Date] DateTime, [Enter End Date] DateTime;
SELECT tblPolicyOrigin.Origin,(Count(qryPolicyNoDate.PolicyID) AS Total
FROM qryPolicyNoDate RIGHT JOIN tblPolicyOrigin ON qryPolicyNoDate.OriginID = tblPolicyOrigin.OriginID
WHERE (((qryPolicyNoDate.DateSubmitted) Between [Enter Start Date] And [Enter End Date]))
GROUP BY tblPolicyOrigin.Origin;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros