目標是批量更新目標表部分字段的數據
操作內容:
1.創建臨時表
drop table if exists tempTableXXX
create table tempTableXXX ( TEMP_ID int not null, BM varchar(14) )
2.把數據存入臨時表
3.把臨時數據中的數據存入目標表
update targetTableXXX ,(select * from tempTableXXX ) b set BM=b.BM where b.TEMP_ID=targetTableXXX.ID
4.刪除臨時表
drop table if exists tempTableXXX
出現問題:
The target table of the UPDATE is not updatable
原因是update的字段在targetTableXXX中不存在=.=
