
Originally Posted by
ApeWare
V
Table A
---------
companyID int(10) pKey
cSerialID int(10) old legacy pkey
Table B
---------
bAgencyID int(10) pkey
companyID int(10)
cSerialID int(10)
Table A has values for both companyID (unique key) and cSerialID.
Table B has values for bAgencyID (unique key) and cSerialID but companyID is empty.
I need to update tableB.companyID with tableA.companyID based on tableb.cSerialID to tablea.cSerialID relationship.
Which way did you try?
I am unsure of mysql syntax, so here is some ANSI SQL:
Code:
Update TableB
set companyID = TableA.companyID
from TableA A, TableB B
Where A.cSerialID = B.cSerialID
HTH
Bookmarks