在access2000的mdb数据库cjgl.mdb中有这两个表:
cy表:
id     name   total
00001  aa
00002  bb
00003  cc
...
99999  as
temp表
id     total
00001  1
00002  1
00003  3
...
99999  99998
实现的效果是将cy中的“total”填完整,内容是来自temp表中的数据
现在我想能不能用一句SQL语句
注:我用下面的方法能实现,但是速度实在太漫长了(5分钟)
adoquery5.Close;
adoquery5.SQL.Clear;
adoquery5.SQL.Add('select * from temp');
adoquery5.Open;
while not adoquery5.Eof do
begin
adoquery4.Close;
adoquery4.SQL.Clear;
adoquery4.SQL.Add('update cy set total='+inttostr(adoquery5.Fields[1].Value)+' where id="'+adoquery5.Fields[0].Value+'"');
adoquery4.ExecSQL;
adoquery5.Next;
end;