select * as table2 from table1 group by aa.c1
select * as table3 from table2 group by aa.c2
表table3就是你想要的结果。

解决方案 »

  1.   

    select * as table2 from table1 group by aa.c1
    select * as table3 from table2 group by aa.c2
    table3就是你想要的结果,没测试过,试试~~~
      

  2.   

    既然是BDE,完全可以新建一个表,然后加入记录
      

  3.   

    create table tablename1
    as select * from aa group by c1
    create table tablename2
    as select * from tablename1 group by c2
    tablename2里就是你要的内容
    用好后,drop table tablename1 和 tablename2 就行了。
      

  4.   

    一行搞定:
    delete from aa.db where aa.c1+aa.c2 not in (select aa.c1+min(aa.c2)  group by aa.c1)
    以上语句是在c2为字符型的条件下写出的.如果不是字符,首先转换一下就行了.
      

  5.   

    s_x_d(烤红薯) :我的方法是否可行?
      

  6.   

    是一个帐物的勾对,字段aa.c1,aa.c2是一个长整型变量,因为有时后有交叉的现象,想取最小的哪个,字段c1,c2一一对应
      

  7.   

    我在SQL server里面试过了.我的方法是可行的.
    select aa.c1+min(aa.c2)  group by aa.c1
    得到的结果是111 222 和 555 666
    之所以在你的数据库中不成功是因为没有转换类型.我不知道parodox中有没有将长整型数据转化为字符型的没有,反正在其它的dbms里面应该是有的.
    比如:
     delete from aa.db where str(aa.c1)+str(aa.c2) not in  (select str(aa.c1)+str(min(aa.c2)) group by aa.c1)
      

  8.   

    试试select a.* from
     aa a, (select c1,min(c2) from aa group by c1) b
    where a.c1 = b.c1 and a.c2 = b.c2
      

  9.   


    with query2 do 
    begin
      close;
      sql.clear;
      sql.add('select distinct c2 from aa newTable where c1 in (select disinct c1 from newTable ) );
      open;
    end;
      

  10.   

    你先在可以删除了,或者是直接对query2进行操作;
    而且,sql也可以进行对重嵌套