Avatar of swaggrK
swaggrK
 asked on

T-SQL using PIVOT to display data

I need to create a join that displays EmployeeID and Rate based on the AttendantCount
Currently the Rate and AttendantCount are displayed as rows but I need to display the data horizontal.
I was told this could possibly be done using PIVOT in t-sql.
I have attached a screenshot of what the result should look like

The CommissionLevelDetail table contains CommissionLevelID, AttendantCount, Rate
The CommissionLevelAssignment table contains CommissionLevelID, EmployeeID


Screenshot of expected resultstbl_CommissionLevelAssignment.xlsxtbl_CommissionLevelDetail.xlsx
Microsoft SQL Server* Pivot Tables* T-SQLSQL

Avatar of undefined
Last Comment
Mark Wills

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mark Wills

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
swaggrK

ASKER
Thanks Mark...this was very useful.
Mark Wills

My pleasure, and very pleased you found it useful :)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy