12. Reporting and Reshaping
Pivoting a Result Set into One Row


Pivoting a Result Set into Multiple Rows





Reverse Pivoting a Result Set




Reverse Pivoting a Result Set into One Column



Suppressing Repeating Values from a Result Set

Pivoting a Result Set to Facilitate Inter-Row Calculations
Creating Buckets of Data, of a Fixed Size
Creating a Predefined Number of Buckets


Creating Vertical Histograms

Returning Non-GROUP BY Columns

Calculating Simple Subtotals

Calculating Subtotals for All Possible Expression Combinations
Identifying Rows That Are Not Subtotals

Using Case Expressions to Flag Rows

Creating a Sparse Matrix

Grouping Rows by Units of Time


Performing Aggregations over Different Groups/ Partitions Simultaneously

Performing Aggregations over a Moving Range of Values

Pivoting a Result Set with Subtotals

Last updated