Here's one way. It will allow for you to add as many title columns as you want:SELECT e.EmployeeHREmpNum ,e.EmployeeLName ,max(case when ca.rn = 1 then ca.JobTitleString end) as JobTitle1 ,max(case when ca.rn = 2 then ca.JobTitleString end) as JobTitle2 ,max(case when ca.rn = 3 then ca.JobTitleString end) as JobTitle3 ,max(ca.rn) AS JobTitleCntFROM dbo.Employee ecross apply ( select jt.JobTitleString ,row_number() over (order by jt.jobTitleString) rn from dbo.JctJobTitle jjt inner join dbo.JobTitle jt ON jt.JobTitleID = jjt.JobTitleID where jjt.EmployeeID = e.employeeid ) caGROUP BY e.EmployeeHREmpNum ,e.EmployeeLName
Be One with the OptimizerTG