码迷,mamicode.com
首页 > 其他好文 > 详细

for update

时间:2015-06-15 20:30:08      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:

对比区别:
  1 select * from TTable1 for update 锁定表的所有行,只能读不能写
  2 select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行
  3 select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定两个表的所有记录
  4 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满足条件的行
  5 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update of a.pkid 只锁定Table1中满足条件的行
  

for update 是把所有的表都锁点 for update of 根据of 后表的条件锁定相对应的表

摘自:http://blog.sina.com.cn/s/blog_6165052c01017rf5.html

for update

标签:

原文地址:http://www.cnblogs.com/danwuxinbolg/p/4578995.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!