About select and crosstab queries

Select and crosstab queries are the two main ways you query a Microsoft Access database to retrieve just the data you want.

Select queries

What is a select query?

A select query is the most common type of query. You use it to:

Multiple-table query and query that performs calculations

1  Bring together data from multiple tables and sort it in a particular order.

2  Perform calculations on groups of records.

Creating a select query

You create a query with a wizard or from scratch in query Design view. In Design view, you specify the data you want to work with by adding the tables or queries that contain the data, and then by filling in the design grid.

How a query looks in Design view and Datasheet view

1  Field lists show the fields in the tables or queries you add to your query.

2  A join line tells Microsoft Access how data in one table or query is related to data in another table or query.

3  You add fields to the design grid by dragging them to the field lists.

4  The fields, sort order, and criteria you add to the design grid determine what you will see in the query's results.

Crosstab queries

What is a crosstab query?

You use crosstab queries to calculate and restructure data for easier analysis of your data. Crosstab queries calculate a sum, average, count, or other type of total for data that is grouped by two types of information — one down the left side of the datasheet and another across the top.

Comparison of a crosstab and a select query

1  This select query only groups the totals vertically by employee and category. This results in more records, making comparisons between different employees' totals more difficult.

2  A crosstab query displays the same information, but groups it both horizontally and vertically so the datasheet is more compact and easier to analyze.

Creating a crosstab query

You create a crosstab query with a wizard or from scratch in query Design view. In the design grid, you specify which field's values will become column headings, which field's values will become row headings, and which field's values to sum, average, count, or otherwise calculate.

Example of how to fill in the query design grid for a crosstab query

1  The settings in these rows determine how data is shown.

2  This setting displays the field's values as row headings.

3  This setting displays the field's values as column headings.

4  These settings display the total orders.

Let Microsoft Access create a select or crosstab query for you

Access can often create a query for you so you don't have to design one from scratch.

If none of these methods satisfies your needs, you can create the query from scratch in query Design view.