采用临时表的方式
create table test_temp (
id int primary key auto_increment,
tid bigint
) ;
insert into test_temp (tid)
select id from table_1;
update table_1 f,test_temp t set sort_num=t.id where f.id = t.tid;
select sort_num From table_1;
drop table test_temp ;
本文介绍了一种使用临时表来优化大规模数据更新操作的方法。通过创建临时表并插入待更新的ID,然后利用该表进行联表更新,最后删除临时表,实现了高效的数据处理流程。
900

被折叠的 条评论
为什么被折叠?



