PC Review


Reply
Thread Tools Rate Thread

Count Null fields

 
 
=?Utf-8?B?TmF0aGFu?=
Guest
Posts: n/a
 
      24th Jan 2006
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?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      24th Jan 2006
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);

--
\\// Live Long and Prosper \\//
BS"D


"Nathan" wrote:

> 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?

 
Reply With Quote
 
Graham Mandeno
Guest
Posts: n/a
 
      24th Jan 2006
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;

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

"Nathan" <(E-Mail Removed)> wrote in message
news:04380DBA-6839-406B-B1CD-(E-Mail Removed)...
>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?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count null fields Steve Goodrich Microsoft Access Getting Started 4 19th Jan 2009 03:04 PM
Count only Not Null fields in report in 2007 Rachael Microsoft Access Reports 3 16th Jul 2008 12:54 PM
Count Fields that are not null on a record =?Utf-8?B?S1JEaXRjaA==?= Microsoft Access 2 31st Jul 2006 08:36 PM
Null Group Fields Not Equal to Null Non-Grouped Fields =?Utf-8?B?Q2hlcnlsIExhbW9uZHM=?= Microsoft Access Queries 3 29th Apr 2005 12:22 AM
Count Number of not null fields on form. Gulf Coast Electric Microsoft Access Forms 3 12th Feb 2004 02:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 AM.