ca1358
asked on
Show 0 when Count is Zero
I am getting a count of Records.
What I need to add is, if the count is zero or null then show the zero has count.
What I need to add is, if the count is zero or null then show the zero has count.
SELECT Count(M_AS400_P112.PCode) AS CountOfPCode, M_AS400_P112.MaintenanceDate, M_AS400_P112.PCode INTO TodayCountAS400P112
FROM M_AS400_P112
GROUP BY M_AS400_P112.MaintenanceDate, M_AS400_P112.PCode;
ASKER
I need syntax of Count(Field) but iif isNull then put a zero.
Maybe this:
SELECT Count( Nz(M_AS400_P112.PCode , 0 ) ) AS CountOfPCode, M_AS400_P112.MaintenanceDa te, M_AS400_P112.PCode INTO TodayCountAS400P112
FROM M_AS400_P112
GROUP BY M_AS400_P112.MaintenanceDa te, M_AS400_P112.PCode;
mx
SELECT Count( Nz(M_AS400_P112.PCode , 0 ) ) AS CountOfPCode, M_AS400_P112.MaintenanceDa
FROM M_AS400_P112
GROUP BY M_AS400_P112.MaintenanceDa
mx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
OK
Ss