Chapter 6. Aggregating and Pivoting Data

This chapter covers various data-aggregation techniques, including the new OVER clause, tiebreakers, running aggregates, pivoting, unpivoting, custom aggregations, histograms, grouping factors, and the CUBE and ROLLUP options.

Throughout this chapter, in my solutions I’ll reuse techniques that I introduced earlier. I’ll also introduce new techniques for you to familiarize yourself with.

Logic will naturally be an integral element in the solutions. Remember that at the heart of every querying problem lies a logical puzzle.

Get Inside Microsoft® SQL Server™ 2005: T-SQL Querying 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.