select * from a where id in
(select id from a group by id having count(1)=1)
------------select * from a where rowid in(
select max(rowid) from a group by col1)

解决方案 »

  1.   

    select * from 表 where rowid=(select max(rowid) from 表 group by 某字段)
      

  2.   

    写错了:
    select * from 表 where rownum in (select max(rownum) from 表 group by 某字段)或:select * from 表 tem where rownum=(select max(rownum) from 表 where 某字段=tem.某字段)
      

  3.   

    select * from 表 where rowid in (select max(rowid) from 表 group by 某字段)或:select * from 表 tem where rowid=(select max(rowid) from 表 where 某字段=tem.某字段)
      

  4.   

    还是CSDN上高手多啊!!好,我试试
      

  5.   

    用分析函数:
    select * from 
    (select a.*,row_number() over(partition by 某字段 order by rownum) rm from 表 a)
    where rm=1;理论上,楼上快,最后利用执行计划测试