table1,table2
while not (table1.eof or table2.eof) do
begin
  if table1.fieldbyname('1')=table2.filedbyname('1') then
    ...
  else
    ...
  table1.next;
  table2.next;
end; 

解决方案 »

  1.   

    TO outer2000(天外流星) 你这通得过么
    if table1.fieldbyname('1')=table2.filedbyname('1') then
    table1.fieldbyname('1').asxxx=table2.filedbyname('1').asxxx
      

  2.   

    to outer2000(天外流星):思路是这样,但我是想要A表中第一条记录的"1"字段值与B表中的第一条记录"1"字段值相比较后,然后又与B表中第二条记录、第三条记录,第四条记录的"1"字段值比较……直到B表的最后一条记录;外重循环加1后,A表中的第二条记录与与B表中的第一条记录,第二条记录,第三条记录"1"字段值相比较……
      

  3.   

    table1,table2
    while not (table1.eof or table2.eof) do
    begin
      if table1.fieldbyname('1')=table2.filedbyname('1') then
        ...
      else
        ...
      table1.next;
      table2.next;
    end; 
      

  4.   

    那就嵌套两层循环啦,这好麻烦啊,不是说程序麻烦,记录多了这个循环要转好久的咧,你到底想干什么,用用别的更优化的方法
    table1,table2
    table1.first;
    while not table1.eof do
    begin
      table2.first;
      while not table2.eof do
      begin
        if table1.FieldValues['l']=table2.FieldValues['l'] then
          ...
        else
          ...
        table2.next;
      end; 
      table1.next;
    end; 
      

  5.   

    找出所有可能相同的组合Select .... 
    From table1, table2
    where table1.l=table2.l
      

  6.   

    table1,table2
    table1.first;
    while not table1.eof do
    begin
      table2.first;
      while not table2.eof do
      begin
        if table1.FieldValues['l']=table2.FieldValues['l'] then
          ...
        else
          ...
        table2.next;
      end; 
      table1.next;
    end; 
      

  7.   

    我要找出A表字段"1"中与B表字段"1"中不同的记录,并且同时给A表和B表的字段"2"符值!!
      

  8.   

    办法蛮多,用哪个都比你这个要快啦
    方法一:
    可以在表A中循环,从表B中用
    'select l from tableb where l='''+tablea.fieldbyname('l').asstring+''''
    找到就有,没找到就没得啦,至少比你用两层循环快多了
    方法二:
    也可以先选出两个表中字段l相同的记录,
    select tablea.*,tableb.l as bl from tablea left outer join tableb on tablea.l=tableb.l   
    数据集中bl有值的就是有相同的了,反之就是你要找的记录了
      

  9.   

    好,谢谢您snjun(@军军@)!