1. update (select...) set column1 = column2;
Update (select iy. company_name company_name1, cc. company_name_jc company_name2
From income_year_item iy, city_company cc
Where iy. company_code = cc. code
)
Set company_name1 = company_name2;
2. Only one row of subquery s is allowed
Update CITY_PROJECT_SCALE_INFO c set
(C. value) = (
Select d. value from CITY_PROJECT_SCALE_INFO @ test d where d. project_id = '7d7fd580a06240b2a9137dc2bbe831e9'
And d. project_id = c. project_id and c. company_code = d. company_code
)
Where exists (
Select 1 from CITY_PROJECT_SCALE_INFO @ test d where d. project_id = '7d7fd580a06240b2a9137dc2bbe831e9'
And d. project_id = c. project_id and c. company_code = d. company_code
)
3. Use the merg inot statement
-- Update basic production fields
Merge into city_cfg_data_column_common cf1 using
City_cfg_data_column_common2 cf2 on
(Cf1.resourceid = cf2.resourceid)
When matched then
Update set cf1.template _ type = cf2.template _ type,
Cf1.chinese _ name = cf2.chinese _ name,
Cf1.column _ name = cf2.column _ name,
Cf1.column _ type = cf2.column _ type,
Cf1.column _ size = cf2.column _ size
When not matched then
Insert (cf1.resourceid, cf1.template _ type, cf1.chinese _ name, cf1.column _ name, cf1.column _ type, cf1.column _ size
, Cf1.is _ can_edit, cf1.is _ unique, cf1.is _ can_cover, cf1.show _ order)
Values (cf2.resourceid, cf2.template _ type, cf2.chinese _ name, cf2.column _ name, cf2.column _ type, cf2.column _ size
, Cf2.is _ can_edit, cf2.is _ unique, cf2.is _ can_cover, cf2.show _ order)