Joins Problem

E

esi

Running the following query and I'm not getting my desired result:

SELECT tblPayroll2004.Period, tblDepartments.[Department Number],
Sum(tblPayroll2004.Hrs) AS Total_OVTHrs, tblPayroll2004.Code
FROM tblDepartments INNER JOIN (tblMonth INNER JOIN tblPayroll2004 ON
tblMonth.Period = tblPayroll2004.Period) ON tblDepartments.[Department
Number] = tblPayroll2004.Dept
GROUP BY tblPayroll2004.Period, tblDepartments.[Department Number],
tblPayroll2004.Code
HAVING (((tblPayroll2004.Code)="OTP"));

My problem is that I want to be able to see [Total_OVTHrs] for each
tblMonth.Period and tblDepartments.[Department Number]. I want to be able
to see all "blanks" or "nulls" as well. My problem is that I cannot perform
to joins in the query and cannot create a query with 1 of the joins and then
query from the first query based on my data table.

Additionally, I need to take 5 queries similar to my above query and combine
them into 1 since, they filter different pay code groupings.
 
M

[MVP] S.Clark

I will typically break something like this into two or three queries, such
that you can perform the Outer Join to get the ALL data that you mentioned.

So, do one query to restrict the data with a WHERE or HAVING, then join that
within another query via the Outer Join.
 

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

Similar Threads


Top