Sei sulla pagina 1di 7

SearchIndividual Business

Experts Exchange Enterprise SIGN UP Log In

How to combine multiple tables in


V
Access 2010 into single table
Hello,

I have 7 tables of information, all tables have the same fields.  I would like to
combine the tables into 1 master table and then remove the previous ones.
 My intent to do this is so I then have just one table to work with in trying to
isolate and remove duplication.  Any and all assistance would be greatly
appreciated.

 Status: Solved Priority:   Medium Security: Public Views: 17954

FreddyBass Who is Participating?


Asked: 2014-09-03

 [Product update] Infrastructure Analysis Tool is now available with Business Accounts.

Learn More

Solutions Learn More Through Courses


Enjoy your complimentary solution view.
Get every solution instantly with Premium. Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful
to me over the last few years. I wear a lot of hats - Developer, Database Administrator,
Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange
gives me answers from people who do know a lot about one thing, in a easy to use

platform." -Todd S.

Neil Russell
Technical Development Lead
Commented: 2014-09-03

LVL 37 INSERT INTO maintablename SELECT * FROM firstoldtable


INSERT INTO maintablename SELECT * FROM secondoldtable
INSERT INTO maintablename SELECT * FROM nextoldtable

etc...

FreddyBass
Author Commented: 2014-09-03

Hi Neilsr,

Thank you for your input, where to put what you have written?

INSERT INTO maintablename SELECT * FROM firstoldtable


INSERT INTO maintablename SELECT * FROM secondoldtable
INSERT INTO maintablename SELECT * FROM nextoldtable

Your issues matter to us.


Facing a tech roadblock? Get the help and
guidance you need from experienced
professionals who care. Ask your question
anytime, anywhere, with no hassle.

START YOUR 7-DAY FREE TRIAL

View Your Complimentary Solution


Promoted by
Tiffany Fabelo
Big Business Goals? Which KPIs Wi
The most successful MSPs rely on
metrics – known as key
performance indicators (KPIs) – for
making informed decisions that
help their businesses thrive, rather
than just survive. This eBook
provides an overview of the most
important KPIs used by top MSPs

Get the Guide


Hamed Nasr
Retired IT Professional
Commented: 2014-09-03

LVL 31 Try:

SELECT * INTO mainTable


FROM (SELECT * FROM tbl1 UNION  SELECT * FROM tbl2 ...  UNION
SELECT * FROM tbl7)

... to be replaced by UNION for all other remaining tables

FreddyBass
Author Commented: 2014-09-03

Hello Neilsr,

I will have a look at the following link and let you know if that provides the
solution I am looking for.

Thank you

Fred


Helen Feddema
Commented: 2014-09-04

It might be better to do this operation in VBA code.  If each table has an ID
LVL 31
field as the key field, you won't be able to append to that field.  Also, you
may need to check for duplicates before adding a record.  In some cases it
might be more appropriate to update an existing record rather than adding
a new one.  here is some typical code for an "append or update" choice:
1: strSearch = "[Code] = " & lngCode
2: Debug.Print "Search string: " & strSearch
3: rstTarget.FindFirst strSearch
4:
5: If rstTarget.NoMatch = True Then
6: 'Add new record
7: rstTarget.AddNew
8: rstTarget![Code] = lngCode
9: rstTarget![TechName] = strTech
10: rstTarget![WorkDate] = dteWork
11: rstTarget![StartTime1] = rstSource![StartTime]
12: rstTarget![EndTime1] = rstSource![EndTime]
13: curRate = CCur(Nz(rstSource![Rate]))
14: rstTarget![Rate] = curRate
15: rstTarget.Update
16: Else
17: 'Update existing record
18: rstTarget.Edit
19: rstTarget![StartTime2] = rstSource![StartTime]
20: rstTarget![EndTime2] = rstSource![EndTime]
21: rstTarget.Update
22: End If

Select all Open in new window

FreddyBass
Author Commented: 2014-09-12

Thank you for providing me the link, I was able to find more information
there for what I am trying to do

EDGE OUT THE COMPETITION


for your dream job with proven skills and certifications.
GET STARTED TODAY

C++ 11: Fundamentals C++ 11: In

29 lessons 53 lessons

Peter Thorsteinson Pete

Services
Individual | Training

Business | Training
Enterprise
Pricing
Experts
Certified Professionals
Apply Now
Company
About
Topics
Careers
Contact Us
Enjoy your complimentary solution view.
Get every solution instantly with Premium. Start your 7-day free trial.
© 1996-2018 Experts Exchange, LLC. All rights reserved. Covered by US Patent.
Privacy Policy Terms of Use

Potrebbero piacerti anche