Using Agregate "Count" to return 0 for Null values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to count entries for 12 periods and have query return 0 when
there are no entries for that period but can't get the language correct.
Please help. SQL follows:

SELECT [tblDatesGS-W].MonthID, Count(PreCountQuery.Expr1) AS CountOfExpr1
FROM [tblDatesGS-W] INNER JOIN PreCountQuery ON [tblDatesGS-W].MonthID =
PreCountQuery.MonthID
GROUP BY [tblDatesGS-W].MonthID;

Thanks
 
Assuming that tblDatesGS-W has entries for each period, try replacing INNER
JOIN with LEFT JOIN.
 
Thank you. That solved the problem.
--
Rob Allison
RCA Enterprises


Douglas J. Steele said:
Assuming that tblDatesGS-W has entries for each period, try replacing INNER
JOIN with LEFT JOIN.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Rob Allison said:
I am trying to count entries for 12 periods and have query return 0 when
there are no entries for that period but can't get the language correct.
Please help. SQL follows:

SELECT [tblDatesGS-W].MonthID, Count(PreCountQuery.Expr1) AS CountOfExpr1
FROM [tblDatesGS-W] INNER JOIN PreCountQuery ON [tblDatesGS-W].MonthID =
PreCountQuery.MonthID
GROUP BY [tblDatesGS-W].MonthID;

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top