问一下 有关Oracle的 
我有几万条数据 我想显示a列重复的数据
a
----

2
2
3
3
4
4想要的结果
a
---------
2
2
3
3
4
4如果我单纯的用  
select a from table where a in(select a from table group by a having count(a)>0) 花了40秒。
想不出还有其他的语句更快的实现? 

解决方案 »

  1.   

    你直接这样就可以了.select * from table group by a having count(*)>0
      

  2.   

    select a from table where a in (select a from table group by a having count(a)>0)
    你这个很优化 了呀have a try:select *
      from (
             select a, count(1) over(partition by a) cnt
               from a
    )
    where cnt > 1
      

  3.   

    试下select a from table a,(select a from table group by a having count(a)>0) b where a.a=b.a