最终的方法:不用SQL语句,用代码实现。打开两个记录集,比较 并更新。 Set Rs1=Cn.Execute("select * from 表1") rs1.movefirst do while not rs1.eof set rs2=cn.execute("select * from 表2 where [字段2]=" _ & rs1!字段1 ) if not (rs2.bof and rs2.eof ) then rs11!字段1=rs2!字段2 endif rs1.movenext loop
set 表1.字段1=表2.字段2
from 表1 ,表2
where 表1.ID=表2.ID
并更新。
Set Rs1=Cn.Execute("select * from 表1")
rs1.movefirst
do while not rs1.eof
set rs2=cn.execute("select * from 表2 where [字段2]=" _
& rs1!字段1 )
if not (rs2.bof and rs2.eof ) then
rs11!字段1=rs2!字段2
endif
rs1.movenext
loop