Guest_imported
New member
- Jan 1, 1970
- 0
I'm joining data from various tables concerning Employees and the amount of time they have worked on a particular project.
The below query will return all of the pertinent information, but I want to specify that the Sum of Hours from the Main table be between specified dates and still display all the other information even if an Employee did not register any hours. I tried sticking in "where date between ......." right before the "group bys" but this restricts the query to only display employees with logged hours.
the query as it is currently is below and any help to modify it to work with selected dates would be greatly appreciated.
SELECT Employee.EmployeeID, [Employee].[FirstName]+' '+[Employee].[LastName] AS Name, Employee.DefSchedule AS Schedule, Employee.ClockedInOut, Project.Project, Sum(main.Hours) AS Hours
FROM Project RIGHT JOIN (Employee LEFT JOIN Main ON Employee.EmployeeID = Main.EmployeeID) ON Project.Chargenumber = Employee.CurrChargeNum
GROUP BY Employee.EmployeeID, Employee.DefSchedule, Employee.ClockedInOut, Project.Project, Employee.FirstName, Employee.LastName
ORDER BY Employee.EmployeeID;
Thanks,
Walter Cantrell
The below query will return all of the pertinent information, but I want to specify that the Sum of Hours from the Main table be between specified dates and still display all the other information even if an Employee did not register any hours. I tried sticking in "where date between ......." right before the "group bys" but this restricts the query to only display employees with logged hours.
the query as it is currently is below and any help to modify it to work with selected dates would be greatly appreciated.
SELECT Employee.EmployeeID, [Employee].[FirstName]+' '+[Employee].[LastName] AS Name, Employee.DefSchedule AS Schedule, Employee.ClockedInOut, Project.Project, Sum(main.Hours) AS Hours
FROM Project RIGHT JOIN (Employee LEFT JOIN Main ON Employee.EmployeeID = Main.EmployeeID) ON Project.Chargenumber = Employee.CurrChargeNum
GROUP BY Employee.EmployeeID, Employee.DefSchedule, Employee.ClockedInOut, Project.Project, Employee.FirstName, Employee.LastName
ORDER BY Employee.EmployeeID;
Thanks,
Walter Cantrell