Count Only Non-Zero Values

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

Guest

Is there a way to count only non-zero values in a query, and ignore zero
values? The numeric field is substituted with 0 (zero) if it's null. Any
pointers are greatly appreciated. Thanks.
 
Substituted by what means? Nz function? Or by Format property? Show us an
example of the query that you're trying to use.

In general, one can count such things by using a Sum aggregate function in
this way:

SELECT Field1, Sum(IIf(Field2 Is Null, 0, 1)) AS NonNullCountField2
FROM TableName
GROUP BY Field1;
 
Back
Top