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

Copy data from one table.column to another

Status
Not open for further replies.

hpl2001

Programmer
Joined
Dec 18, 2001
Messages
105
Location
CA
Hi:

I am trying to copy data from one table into existing rows in another table. Here is a sample structure:

Table1.LocId
.Date
.otherdata
.number (there is a value in this field)

Table2.LocId
.Date
.otherTableSpecificData
.number (currently null)

I want to copy the number field value from Table1 into the corresponding number field in table2 where Table1.LocID=Table2.LocID and Table1.Date=Table2.Date.

How is this done?

TIA.

Holly

 
UPDATE Table2 INNER JOIN Table1 ON Table2.LocId=Table1.LocId AND Table2.Date=Table1.Date
SET Table2.number=Table1.Number
WHERE Table2.number Is Null

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That great. Thanks for the help.

Holly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top