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

Update field based on data in other table 1

Status
Not open for further replies.

bmc1234

Programmer
Jul 21, 2005
50
US
I have one table called TableA with two fields for Partnumber and Serialnumber. I want to add another field called repairID and fill it as follows:

In a second table called TableB, there is a repairID as the primary key and Partnumber and SerialNumber fields. these two fields, when paired together are unique in this table. I want to fill TableA.repairID with TableB.repairID by matching the parnumber and serialnumber from the two tables. Does anybody know how to do this? Thanks.
 
Perhaps this ?
UPDATE TableA A INNER JOIN TableB B ON A.Partnumber = B.Partnumber AND A.SerialNumber = B.SerialNumber
SET A.repairID = B.repairID

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top