Access XP
Running Database Queries
Creating a Multiple-table Query
Queries are not confined to just a single table. You can create a query that runs against multiple fields in multiple tables. This query is created in an identical manner to the single-table query defined on the previous page. The only difference when creating a multiple-table query is that after selecting the fields in one table, as we saw in the last example, you then select the next table and choose additional fields.
In this query, we will ask for the name, contact type, and phone number of all records in the Contacts table. When we create the query, we will select fields from two tables: Contacts table (Last Name, First Name, and Work Phone fields) and Contacts Type table (Contact Type field).
To Create a Multiple-table Query:
- Open the Contacts Management database.
- In the database window, choose the Queries tab from the Object palette.
- Select the Create query by using wizard options and click the Open button .
- The Simple Query Wizard opens.
- From the Tables/Queries drop-down list, choose the first table where you would like to perform the query (e.g., Contacts).
- From the Available Fields, select the fields to be included from this table (e.g., Last Name, First Name, and Work Phone).