Using Union Queries in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a good example as to why one would use a union query in Access. Any
examples would be really helpful.

Thanks
 
Normally it would be if someone had a bad database design (but not always).
If someone has two tables that are identical (or very very similar) they
would need to pull data from more than one table. In most cases, these two
tables could have been combined into one with a "type" field.

Example: A table is created to store "transactions". At the end of the
year, a new blank table is made and all transactions start going into the
new table. tblTransactions2003, tblTransactions2004, tblTransactions2005,
etc. This is a case where it would be better to simply include a date and
keep them all in one table.

Example2: From yesterday - One table contains vendor names, numbers,
addresses, contacts etc. Another table contains customer name, phone,
address. The poster wanted to create a master phone list to print for some
department. A Union query allowed them to pull all names and numbers to one
list.

Hope that helps.
 
Note:

If you want to see real life examples, why not just read the previous posts
that pertain to Union queries?

The easiest way I have found is to go to www.google.com, click the "groups"
option, and enter
a search string like the following...

microsoft.public.access Union
 
I have a massive UNION query that I wrote (over 300 lines) that I use in a
report. Each section of the UNION is designed to pull the data from
different tables but the criteria is different for each section. The query
is built so that data is returned for only one section, depending on how the
paramater is entered. The query is too long and complicated to post here,
but this might give you an idea of one possibility for UNION queries.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
Back
Top