SQL

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 11
Reputation: kimbula... is an unknown quantity at this point 
Solved Threads: 0
kimbula... kimbula... is offline Offline
Newbie Poster

SQL

 
0
  #1
Jul 4th, 2009
Hi all,
I need a favor on SQL this time

There are 4 tables as follows

Employee(EmpID,EmpName,...........)
Designation(Des_ID,Designation....)
EmpProfInfo(EmpID,Des_ID,..........)
Training(TrainingTypeID,EmpID,TrainingType,.......)

When an employee allocated to a training their details will be inserted in to the Training Table

I want to write a sql query so that I can select EmpID,EmpName,Designation of employees who do not participated in the particular training type

It would be a great help if anyone could show me a way to achieve this
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 269
Reputation: GeekByChoiCe is on a distinguished road 
Solved Threads: 53
GeekByChoiCe GeekByChoiCe is offline Offline
Posting Whiz in Training

Re: SQL

 
0
  #2
Jul 4th, 2009
Im only in MYSQL but this might also works in MSSQL

SELECT * FROM Employee WHERE Employee.EmpID NOT IN (SELECT EmpID FROM Training WHERE TrainingType=0);
Last edited by GeekByChoiCe; Jul 4th, 2009 at 4:11 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 148
Reputation: samir_ibrahim is on a distinguished road 
Solved Threads: 16
samir_ibrahim's Avatar
samir_ibrahim samir_ibrahim is offline Offline
Junior Poster

Re: SQL

 
0
  #3
Jul 4th, 2009
Try this

SELECT Training.EmpID, Training.TrainingType, Employee.EmpName, EmpProfInfo.Des_ID, Designation.Designatio
FROM Designation RIGHT OUTER JOIN
Employee RIGHT OUTER JOIN
EmpProfInfo RIGHT OUTER JOIN
Training ON EmpProfInfo.EmpID = Training.EmpID ON Training.EmpID = Employee.EmpID ON Designation.Des_ID = EmpProfInfo.Des_ID
WHERE (Training.TrainingType <> 'Type1')
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC