I have the following table with two fields namely a and b as shown below:
create table employe ( empID varchar(10), department varchar(10) );
for If condition is : Z and Y
SELECT EMPID FROM EMPLOYE WHERE DEPARTMENT='Z' AND EMPID IN (SELECT EMPID FROM EMPLOYE WHERE DEPARTMENT ='Y')AND EMPID NOT IN(SELECT EMPID FROM EMPLOYE WHERE DEPARTMENT NOT IN ('Z','Y'))