O'Reilly logo

Programming Microsoft® SQL Server™ 2008 by Leonard Lobel, Andrew Brust, and Stephen Forte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The GROUPING SETS Operator

The GROUP BY clause has been part of the SELECT statement syntax since the earliest dialects of T-SQL. We use GROUP BY to create queries that collapse multiple rows belonging to the same group into a single summary row and perform aggregate calculations (such as SUM and AVG) across the individual rows of each group. SQL Server 6.5 later extended the GROUP BY clause by adding the WITH CUBE and WITH ROLLUP operators. These operators perform additional grouping and aggregation of data in standard relational queries, similar to what is provided by online analytical processing (OLAP) queries that slice and dice your data into Analysis Services cubes, but without ever leaving the relational database world. SQL Server 2008 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required