O'Reilly logo

Microsoft® SQL Server™ 2005: Applied Techniques Step by Step by Solid Quality Learning

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

Computing Totals and Subtotals

You can use other aggregate functions to obtain summarizations and totals of data in your tables.

Tip

All the modifiers you’ve learned to use for the COUNT function are available for any other aggregate function.

Computing Totals

You have to obtain totals to answer questions like: “How much money did we get from sales?” or “How many units have we sold of this product?” You could count records using a custom application. However, you will be able to get the desired information more efficiently by directly querying the database.

Using SUM

The SUM function does exactly what you would expect: it yields the sum of values ...

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