Barry has attended:
Access Intermediate course
Access Advanced course
Access VBA course
Access 2007 Forms
What is a union query for?
RE: Access 2007 Forms
Hi Barry
The UNION query allows you to combine the result sets of 2 or more "Select" queries. It removes duplicate rows between the various "Select" statements. To create a UNION quey you have to write the SQL String manually on the SQL Window. You cannot use the design view.
Each SQL statement within the UNION query must have the same number of fields in the result sets with similar data types.
The syntax for a UNION query is:
Select field1, field2, . field_n
From tables
UNION
Select field1, field2, . field_n
From tables;
For Example:
Select Customer_Id
From Customers
UNION
Select Customer_id
From Orders;
In this example, if a Customer_Id appeared in both the Customers and Orders table, it would appear once in your result set.
The UNION query removes duplicates.
Hope this helps
Carlos