Query Help

kapil0712

Registered User.
Local time
Today, 11:30
Joined
Jun 2, 2008
Messages
11
I have 15 different trainings and I need to find whether a particular training is been taken or not...

If I am simply using the query with <> "Training name"
Then it is still displaying the individual name since the other trainings that he has taken are not equal to "Training name"

i.e. I want the query to consider only that particular training name and not bother about others.

e.g.
Employee Training name
John Safety
John General Awareness
John Security

Here if i want to find whether the person has taken "Safety" training or not, then I am using simply the query training name <> "Safety"

however this query is showing the individual name JOHN since other two records are not "Safety"

Here i would not like to display the name JOHN since he has already taken that particular training. No matter what other trainings he has taken
Thanks in advance
Please help
 
Code:
select name, 'Safety' as MissedTraining
from mytable
where name not in
(select name from mytable where [Training name] = 'Safety');

is one way to do this.
 

Users who are viewing this thread

Back
Top Bottom