Re: Query to Count, but return items that are null
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Tue, 31 Jan 2006 11:02:00 -0600
Sandy wrote:
>I used the following query:
>
>SELECT tblDeclaration.Declaration, Count(*) AS NumOfDecl
>FROM tblDeclaration Left JOIN tblCalls ON tblDeclaration.DeclarationID =
>tblCalls.DeclarationID
>GROUP BY tblDeclaration.Declaration;
>
>It still isn't returning any rows that are less than 1. Any idea what I'm
>doing wrong? Also, I have to manage to use another column from tblCalls -
>CallDate, in addition to getting Count, because I need the count of each
>Declaration between two dates. [By the way, tblCalls is the Main table.]
I think the issue is that you are using Count(*). That will
count all the rows, regardless of their content. Try
changing it to:
. . ., Count(tblCalls.DeclarationID) AS NumOfDecl
--
Marsh
MVP [MS Access]
.
- References:
- Re: Query to Count, but return items that are null
- From: Marshall Barton
- Re: Query to Count, but return items that are null
- Prev by Date: Re: Need help with complicated if statement
- Next by Date: Re: Conditional test to combine multiple records
- Previous by thread: Re: Query to Count, but return items that are null
- Next by thread: Re: SQL Query from 3 linked tables is ignoring the WHERE clause
- Index(es):