Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating records based on another table

Status
Not open for further replies.

scotent

Technical User
Mar 6, 2002
16
GB
I have a list of companies that have a currently empty field for 'Business Sector' I have another table thta contains a portion of the records that have this feild filled in. What is the best procedure for running a query that will update the fields in the new table based on the existing data in the old table?

The company names are the identifier that I can use, I am just a little puzzled as to where to start with the SQL.

Thanks in advance
 
The basic syntax is ...

update tableA
set tableA.name = tableB.name
from tableA, tableB
where tableA.key = tableB.key

Greg.
 
Thanks Greg - finally battered my way through about half an hour ago. Thanks for the tip tho, it is basically what I ended up with. After a lot of attempts that wiped out data from the referring table which was scary. Fortunately I was working on test tables.......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top