Zero not counted

G

Guest

My original question was as follows...
I am trying to COUNT direct hours - but I do not want to count the Zeros ( 0 ). I really want to say, "don't count if it's a zero".
What I omitted to say, it was to be on TWO columns of data, Direct Hours and Indirect Hours, therefore using the WHERE and <>0 gives me a right anwer for the first column, but when I add the same criteria to the next column, I don't have the right answer.
To Michel Walsh, who replied in the first instance, thanks, but do you have an answer for the second WHERE <> 0.
Thanks to all.
 
M

Michel Walsh

Hi,


SELECT COUNT( iif( StandardTime =0, null, StandardTime) ) as
numberOfStandardTimeNotZero,

COUNT( iif( IndirectHour = 0, null, IndirectHour) ) As
numberOfRecordWIthNotZeroIndirectHour

FROM myTable



will produce two counts, one for standard time, one for indirect hour, and
each count would not include the records where the value is zero. I assume
you use Jet (by opposition to MS SQL Server).



Hoping it may help,
Vanderghast, Access MVP



Shirley Zaknich said:
My original question was as follows...
I am trying to COUNT direct hours - but I do not want to count the Zeros
( 0 ). I really want to say, "don't count if it's a zero".
What I omitted to say, it was to be on TWO columns of data, Direct Hours
and Indirect Hours, therefore using the WHERE and <>0 gives me a right anwer
for the first column, but when I add the same criteria to the next column, I
don't have the right answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top