I've reviewed many other posts on here and have become pretty familiar with the Coalesce function, but I haven't been able to figure out how to do this specific task.
So, I have a Commissions table and a Categories table. I've created a gist here so you can see the exact data structure with some example data. Basically, the Commission table has a SalesRepID, LocationID, CategoryID, SurgeonID, and CommissionPercent column.
Using a Coalesce function, I've been able to get something like this by passing in the SalesRepID, LocationID, and SurgeonID:
.05 (Shirts), .05 (Shoes), .05 (Dresses), .10 (Hats), .15 (Pants)
However, I'm trying to get it to look like:
.05 (Shirts, Shoes, Dresses), .10 (Hats), .15 (Pants)
I did try it a few times with STUFF, but I never got the result that I'm looking for.
Which leads me to ask if this is even possible in MsSQL 2008 R2? If it is, any help in getting the result I'm looking for would be greatly appreciated.
Thank you very much for your time & energy,
Andrew