stack query from a group query

I

inungh

I have a following query to calculate base on previous query named [SP
RPT GET RRE CSI PRE]

The pre query some times does not have SumA or SumB which get errors
on this query, since there is no record for SumA and SumB.

Are there any workaround for this?

Your help is great appreciated,



SELECT EDA.EmployeeNO, [SP RPT GET RRE CSI PRE].SplitID, Round(Sum((IIf
(IsNull([SumA]),0,[SumA])+IIf(IsNull([SumB]),0,[SumB]))/(IIf(IsNull
([SumA]),0,[SumA])+IIf(IsNull([SumB]),0,[SumB])+IIf(IsNull([SumC]),0,
[SumC])+IIf(IsNull([SumD]),0,[SumD])))*100,2) AS CSI, Sum([SP RPT GET
RRE CSI PRE].SACD) AS ACD
FROM [SP RPT GET RRE CSI PRE] INNER JOIN (tblSplits INNER JOIN
(tblPIPEmployee AS Supervisors INNER JOIN (tblPIPEmployee AS EDA INNER
JOIN tblPIPEmployee ON EDA.Employee_ID = tblPIPEmployee.EDA) ON
Supervisors.Employee_ID = tblPIPEmployee.Supervisors) ON
(tblSplits.SplitID = tblPIPEmployee.GroupID) AND (tblSplits.DeptID =
tblPIPEmployee.DeptID)) ON [SP RPT GET RRE CSI PRE].EmployeeNO =
tblPIPEmployee.EmployeeNO
GROUP BY EDA.EmployeeNO, [SP RPT GET RRE CSI PRE].SplitID;
 
K

KARL DEWEY

Have you tried to put the Nz function in the pre-query so that a record with
zero is produced?
 

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