Share this Page URL

Chapter 6. Sorting, Filtering, and Retri... > Designing Select Queries - Pg. 207

Sorting, Filtering, and Retrieving Data 207 Designing Select Queries Defining criteria and sort orders in the Advanced Filter/Sort window is similar to the work you'll do designing select queries. However, a select query offers greater control and flexibility in the ways that you can select and order records, and a query can include records from more than one table or another query. In a query, you can display a recordset that includes only the fields you choose, you can use an expression to perform a calculation, and you can summarize and group records. (You'll use select queries most of the time, but you can also use a query to update or delete records, for example. Called action queries , we'll cover these and other types of queries in Chapter 9, "Ex- tending Your Use of Queries.") In the following sections, we'll build a series of select queries. Keep in mind that the records that a query retrieves--often referred to as the query's results --are an active set of records. They are connected to the table (or tables) in which the data is stored. You can update and edit data directly in a query's datasheet (under constraints of referential integrity), although you'll use forms for this job most of the time. Also, you use a query not only to retrieve a specific set of records or to bring records from related tables together, but also to help analyze your data. The views of your data that queries give you, whether in the query datasheet or when the query is used as the basis of a form or report, often reveal a pattern in your data or some other insight that you need to act on. See Also For more information about updating data in a query, see the sidebar "Entering and Up- dating Data in a Query," later in this section. Creating a Query in Design View A query's results are the subset of the data in a table or tables that is determined by the fields you