943,704 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 305
  • VB.NET RSS
Jul 4th, 2009
0

SQL

Expand Post »
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
Reputation Points: 9
Solved Threads: 0
Newbie Poster
kimbula... is offline Offline
14 posts
since Jun 2009
Jul 4th, 2009
0

Re: SQL

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.
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009
Jul 4th, 2009
0

Re: SQL

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')
Reputation Points: 69
Solved Threads: 19
Junior Poster
samir_ibrahim is offline Offline
155 posts
since Sep 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Retreiving data from previous form to next form
Next Thread in VB.NET Forum Timeline: Socket programming....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC