select * from tbname
where rowid in(
select min(rowid) from tbname group by c1,c2,c3);

解决方案 »

  1.   

    或者:
    select tbname.* from 
    (select min(rowid) rid from tbname group by c1,c2,c3) t,
    tbname
    where t.rid=tbname.rowid(+);
      

  2.   

    bzszp(www.bzszp.533.net) 请教,您写的是去掉重复的记录。可是楼主的意思可能并非如此吧!
      

  3.   

    select  *  from  tbname  
    where  rowid  in(  
    select  min(rowid)  from  tbname  group  by  c1); 
    或者:  
    select  tbname.*  from    
    (select  min(rowid)  rid  from  tbname  group  by  c1)  t,  
    tbname  
    where  t.rid=tbname.rowid(+);
      

  4.   

    select  tbname.*  from    
    (select  min(id)  id  from  tbname  group  by  c1)  t,  
    tbname  
    where  t.id=tbname.id(+);
      

  5.   

    是不是这样就行了?
    select * from tbname
    where rowid in(
    select min(rowid) from tbname group by c1);
    我只要C1列不同的首条记录
      

  6.   

    select * from tbname
    where rowid in(
    select min(rowid) from tbname group by c1,c2,c3);这个in可以直接用“=”吧,还有楼主说的是第一条c1列不同,那时不是group by的时候只需要c1就够了那?第二种写法是什么意思哪????应该是为什么还要(+)
      

  7.   

    SQL> select * from a where rowid in(select min(rowid) from a group by c1);        ID C1         C2         C3
    ---------- ---------- ---------- ----------
             1 a          aa         aaa
             3 b          bb         aaa
             4 c          aa         ccc
      

  8.   

    呀,如果这样的话,那这条就是对的了。 bzszp(www.bzszp.533.net) select  tbname.*  from    
    (select  min(id)  id  from  tbname  group  by  c1)  t,  
    tbname  
    where  t.id=tbname.id(+);
      

  9.   

    select  a.*  from  (select  min(id)  id  from  a  group  by  c1)  t,a where  t.id=a.id(+);   ID C1         C2         C3
    ----- ---------- ---------- ----------
        1 a          aa         aaa
        3 b          bb         aaa
        4 c          aa         ccc