I have been playing around with UNPIVOT but it may not be the correct usage. Basically, is it possible to keep the field name and turn it into data? I thought a sample was shown to me in one of my other questions but I believe that was PIVOT.
Thank you Femiolan for showing the proper use of UNPIVOT.
BTW... I saw ScottPletcher used a CROSS APPLY method from a thread called "Trying to unpivot/pivot columns in temp table". What is the difference between using UNPIVOT and CROSS APPLY in this case?
Also thanks AndyC. I just realized that you also showed how to do an Unpivot example in my thread "Combining Fields" I should have checked that thread before posting this one.
Manually PIVOTing usually comes down to a combination of an aggregate function (SUM, MAX etc) around a CASE statement, coupled with a GROUPing. It's a bit more advanced to figure out but can be significantly more efficient in cases where your need to pivot based on multiple columns.