Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make A Union Query 1

Status
Not open for further replies.

Fortborg

Technical User
Jul 26, 2001
15
0
0
US
Hi all,

I've got 2 tables which contain the same column headings.
Payee Name, Purchase Order Number, Ect.

I need to make a union Query to join the two tables, but haven't had much success with the coding. Can anyone suggest sample code to get me on my way?

Thanks.

-Fort
 
EXAMPLE: The number of columns must be the same in all selects and the column names must be the same. Also the type of data in each column has to be the same. Other than that they are faily easy to build. Hint: Create each select in a seperate working query and copy and paste the selects in a UNION query with the word UNION between each.

Select Table1.[Payee name], Table1.[Purchase Order Number]
FROM Table1
Order by Table1.[Payee Name]

UNION

Select Table2.[Payee name], Table2.[Purchase Order Number]
FROM Table2
Order by Table2.[Payee Name];

Let me know if this helps.

Bob Scriver
 
Works like a charm!

Thanks so much, that code was exactly what I needed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top