![]() |
| ||
| SQL 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 |
| ||
| 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); |
| ||
| 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') |
| All times are GMT -4. The time now is 11:29 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC