select a1,a2,a3,a4 from table1 where a1 in (select a1 from table1 group by a1 having count(*) = 1)

解决方案 »

  1.   

    不重复的是指不包含重复的吗? 还是在重复的里面仅选择一个?
    select a1,a2,a3,a4 from t1
    where rowid in (select min(rowid) from t1 group by a1  having count(*) = 1)
      

  2.   

    select * from tbname
    where a1 not in(select a1 from tbname group by a1 having count(*)>1);
      

  3.   

    duanzilin(寻) :谢谢你的关注!
    你上面那种写法会把A1有重复的全部过滤掉的,得不到想要的结果
      

  4.   

    select * from (select t.*,row_number() over(partition by a1) rn from table1) where rn = 1
      

  5.   

    漏了点
    select * from (select t.*,row_number() over(partition by a1) rn from table1 t) where rn = 1
      

  6.   

    好像不能执行。
    错误:
    ORA-30485:在窗口说明中丢失ORDER BY表达式
      

  7.   

    是不是版本问题,改下试试;
    select * from (select t.*,row_number() over(partition by a1 order by a2) rn from table1 t) where rn = 1
      

  8.   

    select * from 
    (select t.*,row_number() over(partition by a1 order by a1) rn from table1 t) 
    where rn = 1
      

  9.   

    谢谢大家帮忙,问题解决了:)
    多谢duanzilin(寻)和bluecocoqd(小骗骗)