NZ function - can't count

I have created a query where Status = 2, count all names as MemberQty - that works just fine - I get an answer of Status 2 and Members 145.
But when I change it to Status = 3, count all names as AssociateQty, it doesn't work because there are no Associates.  The answer is null.
Working in query design, I have 2 columns -Status and AssociateQTY: NZ([NCODE],0).  I believe this should give me an answer of Status 3 and Associate 0 - but it doesn't.
Any help would be appreciated

msmerryAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
msmerry,
if your original question/problem was resolved by a post/s, please accept the comment to close this thread and open new one for your other requirements.

you will get faster respond if you will limit your question to one per thread.

after you close the thread, you can click the "ask a related question"  at the bottom of the page.
0
 
Patrick MatthewsCommented:
Please post the full SQL statement you are using.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Can you post the SQL for the query?
mx
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Rey Obrero (Capricorn1)Commented:
try a query like this


SELECT Table3.Status, Sum(IIf([Status]=2,1,0)) AS MemberQty, Sum(IIf([Status]=3,1,0)) AS AssociateQty
FROM Table3
GROUP BY Table3.Status;
0
 
msmerryAuthor Commented:
As requested, the SQL statement

SELECT [2BMembershiptbl].Status, [TBL STATUS].EXPLANATION, Count(NZ([NCODE],0)) AS MEMBERQTY
FROM (2AANAMES INNER JOIN 2BMembershiptbl ON [2AANAMES].ACODE = [2BMembershiptbl].MCODE) INNER JOIN [TBL STATUS] ON [2BMembershiptbl].Status = [TBL STATUS].STATUS
GROUP BY [2BMembershiptbl].Status, [TBL STATUS].EXPLANATION
HAVING ((([2BMembershiptbl].Status)="2"));
0
 
Rey Obrero (Capricorn1)Commented:

try this query

SELECT [2BMembershiptbl].Status, [TBL STATUS].EXPLANATION, Sum(IIf([Status]=2,1,0)) AS MemberQty, Sum(IIf([Status]=3,1,0)) AS AssociateQty
FROM (2AANAMES INNER JOIN 2BMembershiptbl ON [2AANAMES].ACODE = [2BMembershiptbl].MCODE) INNER JOIN [TBL STATUS] ON [2BMembershiptbl].Status = [TBL STATUS].STATUS
GROUP BY [2BMembershiptbl].Status, [TBL STATUS].EXPLANATION
0
 
msmerryAuthor Commented:
Capricorn1 thank you, that works perfectly - all I need to finish the job is how to make a Total
0
 
msmerryAuthor Commented:
Thanks Capricorn1
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.