Totals Won't Count Nulls

  • Thread starter Thread starter jgraves
  • Start date Start date
J

jgraves

My Access Table has a columns containing various values, including null. See
below.

Error Code
------------
A
A
B
C
(Null)
C
D
V
(Null)

I am trying to produce query results where each code is displayed with the
number of times it appears by using Totals. Using design view, I drag the
column name down twice, click Totals, then change one to "Group" and one to
"Count". Fine except that my query results show zero for "Null" no matter how
many nulls appear. Why won't it show 2 nulls, for example if the above data
was being used?

Here is what results:
Error Code CountofError Code
------------ ----------------------
(null) 0
A 2
B 1
C 2
D 1
V 1

Thanks for any help whatsoever.

Jen Graves
 
COUNT(*) counts the nulls, COUNT(fieldOrExpression) does not count the
nulls.


SELECT errorCode, COUNT(*)
FROM somewhere
GROUP BY errorCode


instead of

SELECT errorCode, COUNT(errorCode)
FROM somewhere
GROUP BY errorCode



Vanderghast, Access MVP
 
Back
Top