Re: query help

From: Shanin (shanin_at_discussions.microsoft.com)
Date: 08/30/04


Date: Mon, 30 Aug 2004 12:19:04 -0700

That appears to be working except for one thing I failed to mention. Their
titles and wages are kept in that table tblWage which can show their history
of wage changes and job titles. So the way it's worded now, it's pulling
that training for every listing in the wage table. I just need it to look at
their last title. So do I just need to put in that AND statement
T3.Title.last??

"Gerald Stanley" wrote:

> Try
> SELECT T2.Training, [LastName] & "," & [FirstName] AS Name,
> T3.Title
> FROM tblTrainingList AS T2, tblEmployees AS T1 INNER JOIN
> tblWage 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")
> ORDER BY [LastName] & "," & [FirstName];
>
> Hope This Helps
> Gerald Stanley MCSD
> >-----Original Message-----
> >I have a query that looks like this:
> >
> >SELECT T2.Training, [LastName] & "," & [FirstName] AS Name
> >FROM tblEmployees AS T1, tblTrainingList AS T2
> >WHERE (((T2.Training) Not In (SELECT DISTINCT Training
> FROM tblTraining
> >WHERE EmployeeID = T1.EmployeeID)))
> >ORDER BY [LastName] & "," & [FirstName];
> >
> >
> >The point of that is to view which employee doesn't have a
> training listed
> >in the training table. The thing I would like to do is be
> able to exclude
> >some people from this search according to their job title,
> since everyone
> >doesn't need every training that is listed in the
> tblTrainingList. Any time
> >I try to add the table with that info and put in the
> title, I get "You tried
> >to execute a query that does not include the specified
> expression 'Training'
> >as part of the aggregrate function."
> >
> >Here is the SQL when I get that:
> >
> >SELECT T2.Training, [LastName] & "," & [FirstName] AS
> Name, tblWage.Title
> >FROM tblTrainingList AS T2, tblEmployees AS T1 INNER JOIN
> tblWage ON
> >T1.EmployeeID = tblWage.EmployeeID
> >WHERE (((T2.Training) Not In (SELECT DISTINCT Training
> FROM tblTraining
> >WHERE EmployeeID = T1.EmployeeID)))
> >GROUP BY tblWage.Title
> >HAVING (((tblWage.Title)="CN/ON")) OR
> (((tblWage.Title)="Residential
> >Supervisor")) OR (((tblWage.Title)="Q"))
> >ORDER BY [LastName] & "," & [FirstName];
> >
> >
> >quick rundown of tables involved.
> >tblEmployees: EmployeeID primary key
> >tblTraining: EmployeeID and Training primary key
> >tblTrainingLIst: Training primary key
> >tblWage: EmployeeID and Date primary key
> >
> >
> >
> >.
> >
>



Relevant Pages

  • query help
    ... I have a query that shows which employee is missing a training by comparing ... tblTraining WHERE EmployeeID = T1.EmployeeID))) ... This works except for the fact that the tblWage is a running table with each ... employee's wage and title history, so for everytime they had a wage increase ...
    (microsoft.public.access.queries)
  • RE: query help
    ... Yes there is a Date field in the tblWage. ... The fields in that table are EmployeeID, Date, Wage, Title, ... >>only results for certain job codes. ...
    (microsoft.public.access.queries)
  • query help
    ... If there are duplicates in the tblWage, ... >that SQL but I forgot to mention a point so I need help ... >employee's wage and title history, ...
    (microsoft.public.access.queries)