Mysql 批量更新update的表与表之间操作
一、方法一
使用User2表数据更新User表:
update User as a ,User2 as b set a.role_id=b.set_value where a.role_id=b.set_key;
二、方法二
使用User2表数据更新User表:
update User set_key=(SELECT name FROM User2 where id = User.set_value); set @i:=1; update Group SET name=CONCAT(name,'_', (@i:=@i+1)) where name in ( SELECT a.GroupName from ( SELECT name as GroupName FROM Group ) as a );
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/4995.html