update tableb set b=(select a from tablea where .....)

解决方案 »

  1.   

    update b set b=(select a from a where a=b)
    能看明白吧
      

  2.   

    DECLARE @name varchar(40)
    DECLARE cur cursor for select a from table where ...
    OPEN cur
    FETCH NEXT FROM curINTO @name
    while @@fetch_status=0
    begin
      if @name=你要的条件
      update table set ......
      FETCH NEXT FROM curINTO @name
    end
    CLOSE cur
    DEALLOCATE cur
    GO
      

  3.   

    update b set b=a.a
    from a,b
    where a.id=b.id