• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Union Queries

A Union query allows you to combine data from two tables with similar structures; data from each table is included in the output. For example, say you have a tblTimeCards table containing active time cards and a tblTimeCardsArchive table containing archived time cards. The problem occurs when you want to build a report that combines data from both tables. To do this, you must build a Union query as the record source for the report:

1.
Click the Queries tab of the Database window and click New.

2.
Select Design View and click OK.

3.
Click Close from the Show Tables dialog box without selecting a table.

4.
Choose Query | SQL Specific | Union to open an SQL window.

5.
Type in the SQL UNION clause. Notice that you can't switch back to the query's Design view. (See Figure 12.33.)

Figure 12.33. An example of a Union query that joins tblTimeCards with tblTimeCardsArchive.


6.
Click the Run button on the toolbar to execute the query.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint