update   table1   set   name=(select   name   from   table2     t1   inner   join   table1     t2   on   t1.id=t2.id)   where   name   is   null
错误的原因是什么,谢谢
是不是因为在做select语句的时候对表加了共享锁,不允许update操作同时加排它锁

解决方案 »

  1.   

    select不加锁。
    报什么错?是不是:select   name   from   table2     t1   inner   join   table1     t2   on   t1.id=t2.id
    这个查询返回了多个值?
      

  2.   

    我在Mysql上测试:报错信息是
    you can't specify target table t1 for update in form clause 
    这个查询返回单个值!
      

  3.   

    update table1 a 
    set name=(select name from table2 b
    where a.id=b.id)
    where name is null;
    不知道MYSQL是否支持这种语法。