table struct:
c1 c2
a   1
a   2
b   3
b   4
c   5
c   6
c   7
select结果:
c1  c2
a   1
b   3
c   5
在c1相同的情况下,c2可以任意值,例如:
c1是c,c2可以是5或6或7

解决方案 »

  1.   

    select c1, c2 from table1 where rowid in (select max(c2) from table1 group by c1);
      

  2.   

    可以参考这个贴
    类似的问题
    http://topic.csdn.net/u/20090907/11/b2fa1e4c-613a-44f5-8bdc-2682afc3486f.html?87532
      

  3.   

    select c1, c2 from table1 where rowid in (select max(rowid) from table1 group by c1);
      

  4.   

    select c1,c2 from 
    (select c1,c2,row_number() over(partition by c1 order by dbms_random.random) rn)
    where rn = 1;
      

  5.   

    select c1, c2 from table1 where rowid in (select min(rowid) from table1 group by c1
      

  6.   

    select c1,c2 from
    (select c1,c2,row_number() over(partition by c1 order by dbms_random.random) rn from tablename)
    where rn = 1;