sticking 2 tables together

hibster

Board Regular
Joined
Aug 8, 2006
Messages
60
Hi Board,

i have 2 tables of the same data (headings), but for different periods. whats the easiest way to attach them together to make 1 table with both sets of data in.

Cheers

Hibs
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Perhaps a UNION query.

SELECT * FROM TABLE1

UNION

SELECT * FROM TABLE2
 
Upvote 0
Its pretty easy. All you are doing is putting the word UNION between the SQL code of each query. And you can get the SQL code of each query pretty easily in Access (it is one of the view).

Here is how you do it:
As long as both of your queries all have same fields in the same order, open one and switch to SQL view. Copy your code, go to the other query, go to SQL view, and add the word UNION at the end (but before the semi-colon), and then paste the other SQL code.
 
Upvote 0
Actually, I just noticed you are working from tables, not queries, which is even easier. As long as they are both set up exactly the same, start a new query, go to SQL View and post Norie's code and replace Table1 and Table2 with your actual table names.

You will now have a query that combines your two tables. You could use a Make Table query to write the results back to a Table, but that ofteny isn't necessary, as you can use Queries for almost anything you can use Tables for.
 
Upvote 0
tried that and it does not work

SELECT
FROM [Jan - July 07] union FROM [Jan - Dec 06];

i am rubbish at this. how do you guys learn this stuff?
 
Upvote 0
hibster

Could you post your solution?

Might help others:)

Samnuni

If you just use UNION the answer is yes.

If you use UNION ALL you get everything.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top