select id from table where .... for update 
update table set column=n where id=id_value

update table set column=n where ....有区别么?

解决方案 »

  1.   

     select for update 是查询语句, 只是为了用X锁 锁定记录,不允许其它数据库连接修改锁定记录
     update 是更新语句,与 select for update 完全是两种数据库操作
      

  2.   

    select id from table where .... for update 
    update table set column=n where id=id_value
    for update 查询锁定记录的,不允许修改表中任何记录。
    update 只是一个更新语句。
      

  3.   

    结果上没区别。 但 for update 会导致表锁定。