GROUP BY queries give you a lot of power when you want to summarize your data. The problem is that sometimes you want to see different levels of aggregation in the same output. T-SQL has a few extensions, such as CUBE, ROLLUP, and COMPUTE, which enable you to get such views of your data. The extensions discussed in this chapter are not ANSI compliant, but the ANSI committee is considering adding the CUBE and ROLLUP extensions to the standard. This chapter requires previous knowledge of GROUP BY queries. If you are not familiar with those, take a look at Appendix A, “DML Basics” before you continue.
Unable to display preview. Download preview PDF.