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!

How do you update Table_2 with data from Table_1?

Status
Not open for further replies.

Gregv1506

IS-IT--Management
Nov 9, 2006
3
CA
Hi,

I have 2 tables and I want to update Table_2 with fields from Table_1.

Table_1 has the following fields
Client_Nr
Name
Address
City

Table_2 has the following fields
Client_Nr
Name
Address
City

Table_2 has records where the Name, Address and City fields are empty.
Client_Nr is filled in both tables.
What is the easiest way:
- to update the records in Table_2 where Name, Address and City are Nill?
- to update all records?

Thanks,

Greg


 
Code:
Update Table_2
Set    Table_2.Name = Table_1.Name,
       Table_2.Address = Table_1.Address,
       Table_2.City = Table_1.City
From   Table_2
       Inner Join Table_1
         On Table_2.Client_Nr = Table_1.Client_Nr

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top