How To Combine Tables in Access

Hi.....could you please tell me step by step how to combine tables with the excat same fields in Access. I read somehting aboutn a UNION query but have no idea how to do it. Thanks.
Nomad2012Asked:
Who is Participating?
 
walterecookConnect With a Mentor Commented:
Whoops
I moved the all....
rather,
Select field1, field2, field3
from table1
Union ALL
select field1, field2, field3
from table2


sorry
0
 
walterecookCommented:
Select field1, field2, field3
from table1
Union
select field1, field2, field3
from table2

This will throw out duplicates
If you want to include duplicates...
Select field1, field2, field3
from table1
Union
select ALL field1, field2, field3
from table2

The key is the number of fields must be the same and in the same order and each field must be of the same datatype.

Walt
0
 
SweatCoderCommented:
select * from mytable1
union
select * from mytable2

if field number and types are not identical, you can't use *, you need field list and they must match up, both number and data type.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
SweatCoderCommented:
i guess i got beat to the punch.  :-)
0
 
GRayLCommented:
In union queries, the first select statement provides the field names for the query. Thus a query Query1:

Select fld1, fd2, fld3 from table1
order by fld1
UNION
select fld43, fld22, fld33 from table2
order by fld43;

provides a table called Query1 in which each of the data types in each field of table1 are the same in each of the successive tables;
0
 
TommyTupaCommented:
Union queries are OK but you can do the same thing with no coding given tables with exact structures.

1. Select table, right click and copy.
2. Rightclick Paste.
3. Select Paste Append and select the table to append to.
4. Click OK and you've just combined tables.
0
 
walterecookCommented:
Well Tommy, that's true.  But an Append query works much better for something like that.

Walt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.