Query help, sorting query

S

Shanin

Here is the query I have:

SELECT [LastName] & "," & [FirstName] AS Name, T2.Training, T1.DateHired
FROM tblEmployees AS T1, tblTrainingList AS T2
WHERE (((T2.Training) Not In (SELECT DISTINCT Training FROM tblTraining
WHERE EmployeeID = T1.EmployeeID)) AND ((T1.Separated)=No))
ORDER BY [LastName] & "," & [FirstName]
WITH OWNERACCESS OPTION;


This pulls all employees who are missing a training and lists them and the
training they have yet to complete. This works great except for one item;
all employees are not required to have these trainings, only ones with
certain job codes.

I have a separate table, tblWage, which keeps track of everyones wage and
title. It keeps a running history of all this and is entered with the field
"DateofChange". What I need the above query to do is look at the "tblWage"
and look at each person's last entry to see what their title is. I have
tried the following, but I can only get it to pull up blank, or only pull up
the first person on the list. Any help would be greatly appreciated.

SELECT T2.Training, [LastName]&", "&[FirstName] AS Name, T3.Title
FROM
tblTrainingList AS T2,
tblEmployees AS T1 INNER JOIN (Select Top 1 Title, EmployeeID FROM
tblWage order by [DateofChange] DESC0 AS T3
ON T1.EmployeeID =T3.EmployeeID
WHERE
T2.Training Not In (SELECT DISTINCT Training FROM tblTraining WHERE
EmployeeID = T1.EmployeeID)
AND T3.Title IN ("CN/ON", "Residential Supervisor", "Q", "Team Leader",
"Q/Case Coordinator")
AND T1.Separated = "No"
ORDER BY [LastName]&", "&[FirstName]
 

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