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

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);

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')

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.