当前位置:Gxlcms > PHP教程 > 还是关于悲观锁的问题,begin与commit之间,可以有多个froupdate语句吗?

还是关于悲观锁的问题,begin与commit之间,可以有多个froupdate语句吗?

时间:2021-07-01 10:21:17 帮助过:13人阅读

是不是可以这样 :
bgein;

select id from 表1 where id=1 for update;
select id from 表2 where id=1 for update;
select id from 表3 where id=1 for update;




update ok=1 set 表1 where id=1;
update ok=1 set 表2 where id=1;
update ok=1 set 表3 where id=1;

commit ;


回复讨论(解决方案)

是的可以,虽然 update 语句写错了(意思到了)

在此期间,其他的连接是不能 update 这几个表的

是的可以,虽然 update 语句写错了(意思到了)

在此期间,其他的连接是不能 update 这几个表的



多谢版主

人气教程排行