你这段代码的思维混乱,而且只用了简单的Select ,where ,
看看游标,优化代码

解决方案 »

  1.   

    用的着一条条循环吗,太慢了吧,用两条SQL语句就搞定了update new set 电子邮件=(select 电子邮件 from two where two.号码=new.号码') where 号码 in (select 号码 from two);insert into new(号码,姓名,电子邮件) select 号码,'',电子邮件 from two where 号码 not in (select 号码 from new);
      

  2.   

    这样出现错误:操作必须使用一个可更新的查询?
    为何
    adoquery1.Close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from new');
    adoquery1.Open;
    adoquery1.Edit;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('update new set 电子邮件=(select 电子邮件 from two where two.号码=new.号码)');
    adoquery1.SQL.Add(' where 号码 in (select 号码 from two)');
    adoquery1.Open;
    adoquery1.Post;