Re: query help
From: Shanin (shanin_at_discussions.microsoft.com)
Date: 08/30/04
- Next message: Jeff: "Re: Big brain problem!"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: Get time from DATE/time field?"
- In reply to: Gerald Stanley: "Re: query help"
- Messages sorted by: [ date ] [ thread ]
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
> >
> >
> >
> >.
> >
>
- Next message: Jeff: "Re: Big brain problem!"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: Get time from DATE/time field?"
- In reply to: Gerald Stanley: "Re: query help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|