30

Creating Crosstab Queries

A Crosstab query is a query that transforms rows of data into columns of data; most often it includes aggregation of some of the data elements. If you need to show the total sales by customer and by month in a matrix, a Crosstab query is a good choice. Crosstab queries transform normalized records into a matrix and display aggregated data at the intersections of the rows and columns. The Crosstab Wizard is a good place to start creating Crosstab queries, but the wizard has limitations and cannot create queries with more than three row headers. Query Design View and SQL View can both be used to make modifications that are not available from the wizard. This lesson discusses the basics of building Crosstab queries using Access 2010.

LESSON SETUP

For this lesson you need Access 2010 and Lesson 30 from the book's website at www.wrox.com. You should be familiar with creating database objects and working with queries using Access 2010 to complete this lesson successfully.

CROSSTAB QUERIES IN ACCESS

A Crosstab query will transform the records (rows) of data from a table into columns in a new table. The Crosstab query can generate a result set of aggregate data in a table typically in the form of True/False values, or the sums of values indicating the number of records that were contained in the previous table and are now a column in the new table. For example, if you have a Customers table that contains a State field, you could use a Crosstab query to generate ...

Get Microsoft® Access® 2010 24-Hour Trainer 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.