update table1 set col2=(select col2 from table2 where table2.col1=table1.col1)
其中,col1为两个表的关键字

解决方案 »

  1.   

    db.execute "update table1 set * =(select * from table2 where table2.coll=table1.coll"
    不是rs.fields,是table2.coll
      

  2.   

    update table1
    set col1=table2.col1,
      col2=table2.col2,
      ...
    from table2
    where table1.id=table2.id
      

  3.   

    coll等于rs![fields],id等于字段名,对吗?
      

  4.   

    Dim conn As ADODB.Connection
    Dim SQLServerConnect As String, SQLUpdate As String
    SQLServerConnect = "Driver={SQL Server};Server=TCL;Database=库A;" & _
        "UID=sa;PWD=;"      '连接字符串
    Set conn = New ADODB.Connection
    conn.ConnectionString = SQLServerConnect
    conn.Open
    SQLUpdate = "update [库A]..[表A] set [库A]..[表A].[字段A]=[库B]..[表B].[字段B] from [库A]..[表A], [库B]..[表B] where [库A]..[表A].[Aid]=[库B]..[表B].[Bid]"
    conn.Execute SQLUpdate