Hello,
This is my first time posting to this site and I wanted to thank you for what is accomplished here. This site has helped me through many problems! Please forgive the phrasing of this question if it is not clear. I have struggled with how to ask it for some time.
I have a query that is pulling from multiple tables for an employee training report.
I need a query that returns the employees (EmployeeID) that have completed 2 Training topics (TrainingTopicID). As an example; has the employee taken the written drivers test which has a TrainingTopicID of 11 and has the employee viewed the driver training video which has a TrainigTopicID of 14.
Below is the current SQL for the query. Using the “Or” criteria returns both instances that the criteria has been met, but I just need a list of employees who have attended both trainings.
SELECT tblEmployees.EmployeeID, tblEmployees.CampusID, tblCampus.Campus, [lastname] & "," & " " & [firstname] AS Name, tblTrainingTopic.TrainingTopicID, tblTrainingTopic.TrainingTopic, tblTraining.[Training Date], tblTrainingCategory.TrainingCategory, tblTrainingCategory.TrainingCategoryID, tblEmployees.Active, Year([Training Date]) AS [Year], DateDiff("m",[Training Date],Now()) AS Months, tblEmployees.EmployeeWorkStatusID
FROM (tblCampus INNER JOIN tblEmployees ON tblCampus.CampusID = tblEmployees.CampusID) INNER JOIN (tblTrainingCategory INNER JOIN (tblTrainingTopic INNER JOIN tblTraining ON tblTrainingTopic.[TrainingTopicID] = tblTraining.[Training Topic ID]) ON tblTrainingCategory.TrainingCategoryID = tblTrainingTopic.TrainingCategoryID) ON tblEmployees.EmployeeID = tblTraining.EmployeeID
WHERE (((tblTrainingTopic.TrainingTopicID)=11 Or (tblTrainingTopic.TrainingTopicID)=14) AND ((tblEmployees.Active)=Yes) AND ((DateDiff("m",[Training Date],Now()))<[tblTrainingCategory].[NumberMonths]));
Any help would be greatly appreciated!
Thanks,
This is my first time posting to this site and I wanted to thank you for what is accomplished here. This site has helped me through many problems! Please forgive the phrasing of this question if it is not clear. I have struggled with how to ask it for some time.
I have a query that is pulling from multiple tables for an employee training report.
I need a query that returns the employees (EmployeeID) that have completed 2 Training topics (TrainingTopicID). As an example; has the employee taken the written drivers test which has a TrainingTopicID of 11 and has the employee viewed the driver training video which has a TrainigTopicID of 14.
Below is the current SQL for the query. Using the “Or” criteria returns both instances that the criteria has been met, but I just need a list of employees who have attended both trainings.
SELECT tblEmployees.EmployeeID, tblEmployees.CampusID, tblCampus.Campus, [lastname] & "," & " " & [firstname] AS Name, tblTrainingTopic.TrainingTopicID, tblTrainingTopic.TrainingTopic, tblTraining.[Training Date], tblTrainingCategory.TrainingCategory, tblTrainingCategory.TrainingCategoryID, tblEmployees.Active, Year([Training Date]) AS [Year], DateDiff("m",[Training Date],Now()) AS Months, tblEmployees.EmployeeWorkStatusID
FROM (tblCampus INNER JOIN tblEmployees ON tblCampus.CampusID = tblEmployees.CampusID) INNER JOIN (tblTrainingCategory INNER JOIN (tblTrainingTopic INNER JOIN tblTraining ON tblTrainingTopic.[TrainingTopicID] = tblTraining.[Training Topic ID]) ON tblTrainingCategory.TrainingCategoryID = tblTrainingTopic.TrainingCategoryID) ON tblEmployees.EmployeeID = tblTraining.EmployeeID
WHERE (((tblTrainingTopic.TrainingTopicID)=11 Or (tblTrainingTopic.TrainingTopicID)=14) AND ((tblEmployees.Active)=Yes) AND ((DateDiff("m",[Training Date],Now()))<[tblTrainingCategory].[NumberMonths]));
Any help would be greatly appreciated!
Thanks,