I have the following SQL Query which displays the list of all the employees of a particular company based on ID of a single employee.
select TU.ApmId as 'ApmId', TU.UserId as 'PayRoll Id',TU.UserName as 'Employee Name',
P.ParLongDesc as 'Company Name'
from smart2uat.dbo.employee_mast TU, smart2uat.dbo.company_mast P where TU.ParID=P.PARID
and TU.ParID=(select EM.ParId from smart2uat.dbo.employee_mast EM where EM.apmid='CBA134')
where CBA134 is employee ID and ParId is a company ID. I want a small modification in the code as: If ParID of a given employee (employeeID) is 29 or 3 or 32 it have to display the combined employee details of all 3 companies else it have to display the employee details of a single company alone. Kindly help in code. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire