a表比b表??
update a set col_sql=(select ... from b where a.id=b.id and a.id=1 and a.col>b.col)

解决方案 »

  1.   

    update a 
    set
    id=(select b.id from a,b where a.id=b.id)
    where exist(select 1 from a,b where a.id=b.id)
      

  2.   

    update a set col_sql=(select ... from b where a.id=b.id and a.id=1 and a.col>b.col)
      

  3.   

    update a set 列=(select 列 from b where a.id=b.id and a.id=1)楼主的题目似乎有问题表a,b通过id关连。想update a的id到b的id
    -----------------
    按这两句似乎没有必要update,既然是相同的,又update做什么?
    ,条件a.id=b.id and a.id=1 
    -----------------------------
    按这句,只要 update a set id=1
      

  4.   

    表a,b通过id关连。想update a的id到b的id,
    条件a.id=b.id 
        and a.id=1确定了你要update的数据为a.id和b.id 都为1的。
       那么你的表也就不用update了,按照你的条件,你的update什么作用都起不了啊。
      

  5.   

    条件有问题:
        “条件a.id=b.id and a.id=1”=》a.id=1 and b.id=1
      

  6.   

    我重新再说一次:
    有两个表clear_temp和clearusr,两个表的acct_id相关联,但clearusr的acct_id比clear_temp的acct_id多,即clearusr的acct_id包括了clear_temp的act_id,问题是想根据clear_temp,改clearusr的cust_id,即改成clear_temp里cust_id的值,但只改clearusr里cust_id=1的记录。
    请问要怎样写sql?
      

  7.   

    update clearusr set cust_id=l where acctid=(select acct_id from clear_temp where cust_id=l)