By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,761 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,761 IT Pros & Developers. It's quick & easy.

Need help with insert query ?

P: n/a
Deear All,
I would be thankful if you could help me with the following query.

I have two tables TableA and TableB

TableA
Name: David
Address: 123 West Side
City: New York

TableB
Name: David
Address: 123 West Side
Profession: Engineer

I need to Insert the data from TableB to TableA if the Address matches

I want to get rid of TableB so I want to merge the data from second and add a
Profession in Table A

So after merging the Table A would be

TableA
Name: David
Address: 123 West Side
City: New York
Profession: Engineer

I would appreciate your help and Thanks in Advance

Nick
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The BIG problem is that you need a way to identify which record in TableA to add
Engineer to! If you go solely on Name, there may be records in TableA that have
the same name but not necessarily duplicates. The best you're going to do is to
use both the Name and Address fields and making the assumption (keeping in mind
the definition of what assumption is) that for the same person, his Name and
Address is entered in to both tables EXACTLY the same way. Given this
ass-umption, create a new field in TableA called Profession. Next include both
tables in a query. Join the Name fields in both tables and join the Address
fields in both tables. Pull down the Profession field from TableA. Change the
query to an Update Query by clicking on the query type button in the toolbar at
the top of the screen. In the query grid where it says Update To under
Profession put:
TableB.Profession.

Click on the red exclamation point in the toolbar at the top of the screen and
depending on the validity of your assumption you will get what you want.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Nick" <n.******@verizon.net> wrote in message
news:d6**************************@posting.google.c om...
Deear All,
I would be thankful if you could help me with the following query.

I have two tables TableA and TableB

TableA
Name: David
Address: 123 West Side
City: New York

TableB
Name: David
Address: 123 West Side
Profession: Engineer

I need to Insert the data from TableB to TableA if the Address matches

I want to get rid of TableB so I want to merge the data from second and add a
Profession in Table A

So after merging the Table A would be

TableA
Name: David
Address: 123 West Side
City: New York
Profession: Engineer

I would appreciate your help and Thanks in Advance

Nick

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.