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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating from one table to another

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am having the hardest time trying to preform an update of data from one table to another. For example:
I have a table with ID(key), Name, address,Phone,other fields, and another table that have the ID(Key), and
Phone(corrected). I Would like to Update the Phone in the first table to be the phone in the second table, joined on the ID.
 
How about:

Code:
update TableA set phone = 
  (select phone from TableB where TableB.ID = TableA.ID)
 
Try:

UPDATE TABLE1
SET TABLE1.PHONENO=TABLE2.PHONENO
FROM TABLE2
WHERE TABLE1.ID=TABLE2.ID

Should work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top