udpate books
set pubid = 
(
   select b.pubid
from publish b
where a.isdn = b.isdn
)

解决方案 »

  1.   

    不好意思,刚才发的有点错误,应该是这样
    udpate books a
    set pubid = 
    (
       select b.pubid
    from publish b
    where a.isdn = b.isdn
    )
      

  2.   

    update books a
    set a.pubid=b.pubid
    where exists (select 1 from publish b 
                 where a.isdn=b.isdn);
      

  3.   

    udpate books a
    set pubid = 
    (
       select MAX(b.pubid)
    from publish b
    where a.isdn = b.isdn
    )
    where exists(select 1 from publish b where a.isdn = b.isdn);
      

  4.   

    update books a
    set a.pubid=(select pubid from publish where isdn=a.isdn)
    where exists (select 1 from publish b 
                 where a.isdn=b.isdn);