Query Tutorials Index:
|New! Download Access example of the Union Query|
More common union queries select real data from two or more real tables. Sometimes the tables in both select statements will be the same and in some circumstances the tables will be different. The only requirement is the you use the same number of fields in each select statement. You can also have numerous union statements within a single query.
Note: Putting a blank letter before the 'A' in All makes this combo choice All choice sort to the top. Warning: General warning about union queries - Never try to use aggregate functions (avg, count, sum, etc.) in a union query. It will drop out duplicate groups of records (in Access at least ).
Here is a union query example in which we want to find the total quantity of mittens sold. In this case we have two tables: Orders and Closed_Orders - we are not sure in which table the order will be so we query both tables at the same time using the union query:
SELECT Orders.Product, Sum(Orders.Qty) AS SumOfQty
GROUP BY Orders.Product
SELECT Product, Sum(Qty) AS SumOfQty
GROUP BY Product
Below are the results of the union query:
More Union Query Examples:
Union Query Downloadable Example
Our Union Query Example demonstrates a method used to add additional ... Click here to download the Microsoft Access Union Query programming example.
Advanced Union Query Download
This union query example shows some interesting and advanced concepts. Usually in a union query you are selecting the same or similar data from different...
A Blue Claw Database Design Template:
Marina Management Reservations Software
A Blue Claw Database Design Article:
Repair Corrupted Access Table
Blue Claw Database Design Downloadable Tutorial:
TransferText & OutputTo Microsoft Access Download.
Copyright 2000-2014 Blue Claw Database Design