This is likely VERY close.
SELECT STM.staffcode_c as [Staff Code],
STM.firstname_vc as [First Name],
STM.lastname_vc as [Last Name],
PC.description_vc as [Program],
STM.department_vc as [Title]
STM.birthcountry_vc as [Spervisor],
supervisor.firstname_vc as [Supervisor First Name],
supervisor.lastname_vc as [Supervisor Last Name]
FROM ar.staffmaster as STM
inner join ar.programcodes as PC on STM.division_vc = PC.code_c
inner join cd.rhd_incidents as I on I.staff_c = STM.birthcountry_vc or I.staff_c = STM.staffcode_c
left join ar.staffmaster supervisor on supervisor.staffcode_c = STM.[Whatever Field is the Supervisor staffcode_c]
I can't tell what column in staffmaster indicates the value of the supervisor. Your query says it is birthcountry_vc but somehow I doubt that is right. 😛
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/