Designating a Record Source with the FROM ClauseThe FROM clause denotes the record source from which your query is to retrieve records; this record source can be either a table or another stored query. You also have the ability to retrieve records from more than one table; see the Joining Related Tables in a Query section later in this chapter for more information on how that works. The FROM clauses work with SELECT clauses. For example, to retrieve all the records in tblCustomer, use the SQL statement SELECT * FROM tblCustomer This query retrieves all the records and all the fields in tblCustomer (in no particular order). To retrieve only the customers' first and last names, use the SQL statement SELECT FirstName, LastName FROM tblCustomer Once you've made the change in the View Designer, use the menu command Query Run to refresh the data output. This command produces the result set shown in Figure 2.3. Figure 2.3. Query results retrieved by running a SELECT against the FirstName and LastName fields of the tblCustomer tableFor reasons of efficiency, always use this technique to limit the number of fields in a SELECT clause to only those fields you know your application will need. Note that records returned by a SELECT FROM are returned in no particular order. Unless you specify a sorting order (using the ORDER BY clause discussed later in this chapter), the order in which records is returned is always undefined. |