update tTor_E_Org org1
set org1.orgname = (org2.orgname + org1.orgname)
from tTor_E_Org org1,
tTor_E_Org org2,
tTor_R_Org_BSIDTree otree1,
tTor_R_Org_BSIDTree otree2
where otree2.bsid = otree1.parentbsid
and org1.bsid = otree1.bsid
and org2.bsid = otree2.bsid
and org1.orgname like '%室%'
我知道这段操作有错误,但是不知道怎么改谢谢大虾

解决方案 »

  1.   

    先把下面语句的逻辑写明白。select org2.orgname + org1.orgname
    from tTor_E_Org org1, 
    tTor_E_Org org2, 
    tTor_R_Org_BSIDTree otree1, 
    tTor_R_Org_BSIDTree otree2 
    where otree2.bsid = otree1.parentbsid 
    and org1.bsid = otree1.bsid 
    and org2.bsid = otree2.bsid 
    and org1.orgname like '%室%' 
      

  2.   

    update tTor_E_Org org1 
        set org1.orgname = (org2.orgname + org1.orgname) 
        from 
             //  这两行一样的表 ,放这里的理由 是什么?
             tTor_E_Org org1, 
             tTor_E_Org org2, 
             //  这两行一样的表 ,放这里的理由 是什么? 
             tTor_R_Org_BSIDTree otree1, 
             tTor_R_Org_BSIDTree otree2 
             where otree2.bsid = otree1.parentbsid 
    and org1.bsid = otree1.bsid 
    and org2.bsid = otree2.bsid 
    and org1.orgname like '%室%'
     
    --在说清一点 哈,