Joining 2 Tables

J

John W. Vinson

How can I join 2 tables that have the same record layouts ?

By using an appropriate query.

Since we don't know anything about the structure of the tables, how they are
related (if at all), nor how you would like them "joined" it's hard to say.

More info please? perhaps an example of what you have and what you want?
 
C

carl

Thank you for helping.

Table1 is like this:

Day Product Qty
2-Jan 1 10
4-Jan 2 1
6-Jan 3 3

Table2 is like this:

Day Product Qty
2-Jan 1 10
4-Jan 2 1
6-Jan 3 3
1-Feb 1 3
2-Feb 2 3
3-Feb 3 3


Thank you in advance.

Day Product Qty
1-Feb 1 3
2-Feb 2 3
3-Feb 3 3


I am trying to join the 2 table to look like this:
 
D

Douglas J. Steele

Do you mean to say that you want to know what entries in Table2 aren't in
Table1?

Use the Find Unmatched Query Wizard. Go to create a new query, select that
wizard, and let it walk you through the process.
 
J

John W. Vinson

Thank you for helping.

Table1 is like this:

Day Product Qty
2-Jan 1 10
4-Jan 2 1
6-Jan 3 3

Table2 is like this:

Day Product Qty
2-Jan 1 10
4-Jan 2 1
6-Jan 3 3
1-Feb 1 3
2-Feb 2 3
3-Feb 3 3


Thank you in advance.

Day Product Qty
1-Feb 1 3
2-Feb 2 3
3-Feb 3 3


I am trying to join the 2 table to look like this:

I presume this was a copy&paste error and that you want to combine the January
data and the February data to produce the six lines?

If so you need a choice of two options:

1. a UNION query. Open the SQL window and type

SELECT [table1].[Day], [table1].[Product], [table1].[Qty]
UNION ALL
SELECT [table2].[Day], [table2].[Product], [table2].[Qty]
ORDER BY [Day];


2. NORMALIZE YOUR DATA!

If you have a separate table for each month your database design IS WRONG.
That makes sense for a spreadsheet (one page per month) but not for a
relational database! Create a new master table, and use a UNION query like the
one above as the source of an append query to move all of the data into one
table.
 
Top