I get asked all the time if I know how to PIVOT SQL data. I do, but I've never used the PIVOT keyword. The problem is that usually the query needs to be put in a report or a SmartList, and PIVOT will return a varying amount of columns. We need a fixed number of columns in reporting.
The technique below will achieve that.
This is not 'fringe' code... you'll use this all the time. Take the time to read and understand. It's short.
The sample will run as-is, cut and paste into SQL