while (not adoquery1.eof) and (not adoquery2.eof) do begin adoquery1.fieldbyname('a1').value:=adoquery2.fieldbyname('a2').value; adoquery1.next; adoquery2.next; end;
adoquery1.first; adoquery2.first; while (not adoquery1.eof) or (not adoquery2.eof) do begin adoquery1.fieldbyname('a1').value:=adoquery2.fieldbyname('a2').value; adoquery1.next; adoquery2.next; end;
with adoquery1 do begin close; sql.clear; sql.text := 'update table1 set a1 = '+ '(select a2 from table1,table2 where table1.a3 = table2.a3)'; execsql; end;
begin
adoquery1.fieldbyname('a1').value:=adoquery2.fieldbyname('a2').value;
adoquery1.next;
adoquery2.next;
end;
adoquery2.first;
while (not adoquery1.eof) or (not adoquery2.eof) do
begin
adoquery1.fieldbyname('a1').value:=adoquery2.fieldbyname('a2').value;
adoquery1.next;
adoquery2.next;
end;
begin
close;
sql.clear;
sql.text := 'update table1 set a1 = '+
'(select a2 from table1,table2 where table1.a3 = table2.a3)';
execsql;
end;
用adoquery.sql='update...'可以实现