Chapter 7. Pivot, Unpivot, and Grouping Sets

This chapter covers techniques for pivoting and unpivoting data and handling grouping sets. Pivoting means rotating data from a state of rows to a state of columns. Unpivoting means rotating data from a state of columns to a state of rows. Grouping sets are sets of attributes that you group by, and this chapter will cover techniques for requesting multiple grouping sets in the same query.

Note that all subjects covered in this chapter may be considered advanced for readers who are new to T-SQL; therefore, the chapter is optional reading. If you already feel comfortable with the material discussed ...

Get Microsoft® SQL Server® 2008 T-SQL Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.