mysql: The target table of the UPDATE is not updatable

目标是批量更新目标表部分字段的数据
操作内容:
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中不存在=.=

posted @ 2020-04-07 16:21  Lulus  阅读(9929)  评论(0编辑  收藏  举报