Home > database >  A database table data migration to B table
A database table data migration to B table

Time:09-20

Will be added to the t_contract_base_area t_contract fsection_name fields in a table, at the same time in contract table ID and t_contract_base_area fcontract_id do data matching, namely t_contract_base_areafcontract_id=contract, fid fsection_name field data values, how to write a script,

CodePudding user response:

 
UPDATE a
The Set a. [need to be updated to the same field]=b. section_name
The FROM t_contract_base_area a
INNER JOIN t_contract b On b. ID=a.f contract_id

CodePudding user response:

 - 1. Add a list 
The alter table t_contract_base_area add fsection_name nvarchar (50)
- 2. Updated table
Update A
The SET A.f section_name=b. section_name
The from t_contract_base_area as A inner join t_contract as B on A.f contract_id=B.I D
  • Related