Count Query Not Counting Nulls

  • Thread starter Thread starter Dale
  • Start date Start date
D

Dale

Access 2000

The following query does not count nulls, How can I
include the null count also?

SELECT Count(qStatsPtType.TypeOfPatientDesc) AS
CountOfTypeOfPatientDesc, qStatsPtType.TypeOfPatientDesc
FROM qStatsPtType
GROUP BY qStatsPtType.TypeOfPatientDesc
ORDER BY qStatsPtType.TypeOfPatientDesc;

This query returns a count of each Pt Type, If the pt
type is null, then it does not show in the results that X
number of records have a blank Pt Type.

TIA
Dale
 
Hi,


That is by definition, in SQL. COUNT(*) counts all the records (after
the criteria WHERE is applied, before the HAVING), while COUNT(FieldName)
counts only the number of not null values in the said field. If you want the
null into the count, use COUNT(*).


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top