Need All In Table To Show

G

Guest

I need to have all the departments in the department table to show whether
they have information in them or not. The query that I am using is

SELECT tblAllWorkLoggedRecords.Date, tblDepartment.Department,
Sum(tblAllWorkLoggedRecords.[VOLUME RECEIVED]) AS [SumOfVOLUME RECEIVED]
FROM tblAllWorkLoggedRecords RIGHT JOIN tblDepartment ON
tblAllWorkLoggedRecords.DEPARTMENT = tblDepartment.Department
GROUP BY tblAllWorkLoggedRecords.Date, tblDepartment.Department
HAVING (((tblAllWorkLoggedRecords.Date)=[Enter date: mm/dd/yyyy]));


I am getting the information that I need but it is only showing the
departments that actually have information but not showing the departments
that have zero

Any help would be great appreciated
 
J

John Spencer

Applying the criteria to the tblAllWorkLoggedRecords negates the right join.
Try the following which should return rows where
tblAllWorkLoggedRecords.Date is null as well as records where the date is a
match

SELECT tblAllWorkLoggedRecords.Date, tblDepartment.Department,
Sum(tblAllWorkLoggedRecords.[VOLUME RECEIVED]) AS [SumOfVOLUME RECEIVED]
FROM tblAllWorkLoggedRecords RIGHT JOIN tblDepartment ON
tblAllWorkLoggedRecords.DEPARTMENT = tblDepartment.Department
WHERE tblAllWorkLoggedRecords.Date=[Enter date: mm/dd/yyyy]
OR tblAllWorkLoggedRecords.Date is Null
GROUP BY tblAllWorkLoggedRecords.Date, tblDepartment.Department
 

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