Count Null fields

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

Guest

I have a table called dbo_Feature and column called FeatureDateClosed.
I want to get a count of any records where the FeatureDateClosed column is
null. I tried a simple count(FeatureDateClosed) query, with no luck. See
below:

SELECT Count(dbo_Feature.FeatureDateClosed) AS Expr1
FROM dbo_Feature
WHERE ((dbo_Feature.FeatureDateClosed) Is Null);

This gives me zero. It should be about 1100. I vaguely recall that count
isn't for null values, but don't remember the work around. Any help?
 
Do the count on a different field, that has a value

SELECT Count(dbo_Feature.[Different field name that is not Null]) AS Expr1
FROM dbo_Feature
WHERE ((dbo_Feature.FeatureDateClosed) Is Null);
 
Hi Nathan

By design, records containing Null in the field that is being counted are
not included in the Count, so this query will always return zero.

To count all records, whether or not they contain nulls, use an asterisk:

SELECT Count(*) AS NullDate FROM dbo_Feature
WHERE dbo_Feature.FeatureDateClosed Is Null;
 
Back
Top