Unable To Count Null Date Field

R

Rob

I am attempting to count null date fields and group them by week field. The
following query identifies the fields with no problem.

SELECT tblSARData.WeekNumber, tblSARData.mannotifieddate
FROM tblSARData
WHERE isnull([tblSARData].[mannotifiedDate]);

Unfortunately, I'm not able to count them and group by the WeekNumber field.
Each attempt results in grouped week numbers and a 0 value for the count
which is incorrect. Here is an example. Any help would be appreciated.

SELECT tblSARData.WeekNumber, Count(tblSARData.mannotifieddate) AS
CountOfmannotifieddate
FROM tblSARData
WHERE (((IsNull([tblSARData].[mannotifiedDate]))<>False))
GROUP BY tblSARData.WeekNumber;
 
R

Rick Brandt

Rob said:
I am attempting to count null date fields and group them by week
field. The following query identifies the fields with no problem.

SELECT tblSARData.WeekNumber, tblSARData.mannotifieddate
FROM tblSARData
WHERE isnull([tblSARData].[mannotifiedDate]);

Unfortunately, I'm not able to count them and group by the WeekNumber
field. Each attempt results in grouped week numbers and a 0 value for
the count which is incorrect. Here is an example. Any help would be
appreciated.

SELECT tblSARData.WeekNumber, Count(tblSARData.mannotifieddate) AS
CountOfmannotifieddate
FROM tblSARData
WHERE (((IsNull([tblSARData].[mannotifiedDate]))<>False))
GROUP BY tblSARData.WeekNumber;

Count(FieldName) never includes in the count Null values. Use Count(*)
instead which does include them. If your criteria selects only the rows you
want then you only need the count of the rows, not of the Null dates.
 
R

Rob

Perfect! Thanks Rick.

Rick Brandt said:
Rob said:
I am attempting to count null date fields and group them by week
field. The following query identifies the fields with no problem.

SELECT tblSARData.WeekNumber, tblSARData.mannotifieddate
FROM tblSARData
WHERE isnull([tblSARData].[mannotifiedDate]);

Unfortunately, I'm not able to count them and group by the WeekNumber
field. Each attempt results in grouped week numbers and a 0 value for
the count which is incorrect. Here is an example. Any help would be
appreciated.

SELECT tblSARData.WeekNumber, Count(tblSARData.mannotifieddate) AS
CountOfmannotifieddate
FROM tblSARData
WHERE (((IsNull([tblSARData].[mannotifiedDate]))<>False))
GROUP BY tblSARData.WeekNumber;

Count(FieldName) never includes in the count Null values. Use Count(*)
instead which does include them. If your criteria selects only the rows you
want then you only need the count of the rows, not of the Null dates.
 

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

Top