query1.sql.add('select a from table'); 
query1.sql.add('where a not in (select b from table)')';
query1.close;
query1.open;
memo1.clear;
while not query1.eof do begin
  memo1.lines.add(query1.fieldbyname('a').asstring);
  query1.next;
end;

解决方案 »

  1.   

    -------sorry
    query1.sql.clear;
    query1.sql.add('select a from table'); 
    query1.sql.add('where a not in (select b from table)')';
    query1.close;
    query1.open;
    memo1.clear;
    query1.first;
    while not query1.eof do begin
      memo1.lines.add(query1.fieldbyname('a').asstring);
      query1.next;
    end;
      

  2.   

    不是吧
    这个问题你好像问过一次吧!Select A From table1 Where A Not In (Select A From table1 Where A = B);也可以:Select A From table1 Where A Not In (Select B From table1 );
    while not query1.eof do begin
      memo1.lines.add(query1.fieldbyname('a').asstring);
      query1.next;
      

  3.   

    用下面的语句作查询;再用楼上诸兄方法显示:
    select a from tbl where a not in (select b from tbl where not b is null)
      

  4.   

    谢谢weizi2000(秋风啊),问题解决,给分