Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
SELECT EmloyeeName, CASE WHEN signID = 2 THEN ApprovingOfficer END AS ApprovingOfficer1, CASE WHEN signID = 1 THEN ApprovingOfficer END AS ApprovingOfficer2FROM dbo.ApprovingOfficer
what i want to happen make the output as 1 row only..sample output:[code]EmloyeeName ApprovingOfficer2 ApprovingOfficer1Christopher Librero Supervisor Manager [code]
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2009-12-07 : 02:55:11
Try this
SELECT EmloyeeName, max(CASE WHEN signID = 2 THEN ApprovingOfficer END) AS ApprovingOfficer1, max(CASE WHEN signID = 1 THEN ApprovingOfficer END) AS ApprovingOfficer2FROM dbo.ApprovingOfficerGROUP BY EmloyeeName