See Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]
and Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url].
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw