oracle查询语句 统计某张表中一个字段重复最多的10条数据怎么写

大哥大姐,请教一下,oracle查询语句 统计某张表中一个字段重复最多的10条数据怎么写
最新回答
我丑故我知

2024-10-17 10:57:35

SELECT 字段名,cn
FROM (SELECT 字段名,
count(*) as cn,
row_number() over(order by count(*) desc) as rn
from 表名 t
group by t.字段名 having count(*)>1)
where rn < 11;