问一下 有关Oracle的
我有几万条数据 我想显示a列重复的数据
a
----
1
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秒。
想不出还有其他的语句更快的实现?
我有几万条数据 我想显示a列重复的数据
a
----
1
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秒。
想不出还有其他的语句更快的实现?
你这个很优化 了呀have a try:select *
from (
select a, count(1) over(partition by a) cnt
from a
)
where cnt > 1