Examples of union queries (MDB)
From Microsoft Office Access 2003
The following union query selects all company names and cities from both the Suppliers and Customers tables, and sorts the data alphabetically by city.
SELECT [CompanyName], [City]
FROM [Suppliers]
UNION SELECT [CompanyName], [City]
FROM [Customers]
ORDER BY [City];
The following union query renames the CompanyName field to "Supplier/Customer Name" in the query output.
SELECT [CompanyName] AS [Supplier/Customer Name], [City]
FROM [Suppliers]
UNION SELECT [CompanyName] AS [Supplier/Customer Name], [City]
FROM [Customers];
The following union query uses the UNION ALL statement to retrieve all records, including duplicates.
SELECT [CompanyName], [City]
FROM [Suppliers]
UNION ALL SELECT [CompanyName], [City]
FROM [Customers];