update t2004 set t2004.street = tax_jb.scjxdm 
from t2004,tax_jb where t2004.nsrmc = tax_jb.nsrmc我需要更新t2004表中的street字段,把它替换成tax_jb里的scjxdm 这个字段
用nsrmc来对应 这样写有什么问题?
PLSQL Developer说我sql命令没正确结束。

解决方案 »

  1.   

    update 
       t2004 
      set t2004.street = 
          (select tax_jb.scjxdm from t2004,tax_jb where t2004.nsrmc = tax_jb.nsrmc )
      

  2.   

    试试
    update t2004 set t2004.street = tax_jb.scjxdm from t2004,tax_jb where t2004.nsrmc = tax_jb.nsrmc
    改成
    update t2004 set t2004.street = (select tax_jb.scjxdm from t2004,tax_jb where t2004.nsrmc = tax_jb.nsrmc)
       where exists (select tax_jb.scjxdm from t2004,tax_jb where t2004.nsrmc = tax_jb.nsrmc);
      

  3.   

    先确定你要更新的数据很明显,你要更新的字段在tax_jb表里对应了多个值
      

  4.   

    返回多于一行的话可以在子查询的条件中加入 rownum=1 ,就不报错了
      

  5.   


    update t2004 
    set t2004.street = (
       select distinct(tax_jb.scjxdm) 
       from t2004,tax_jb 
       where t2004.nsrmc = tax_jb.nsrmc)