https://www.cnblogs.com/zhoujie0710/p/15556398.html
select
a.* ,
(
select
count(b.cnt_zb) CNT
from
(
select
col_12 yzdw,
col_23 zbdw,
count(1) cnt_zb
from
vc_collect_zbxx a
where
col_22 >= ‘2022-01-01 00:00:00’
group by
col_12,
col_23) b
where
b.cnt_zb > a.cnt_zb )+ 1 rank
from
(
select
col_12 yzdw,
col_23 zbdw,
count(1) cnt_zb
from
vc_collect_zbxx a
where
col_22 >= ‘2022-01-01 00:00:00’
group by
col_12,
col_23
) a
where
((
select
count(b.cnt_zb) CNT
from
(
select
col_12 yzdw,
col_23 zbdw,
count(1) cnt_zb
from
vc_collect_zbxx a
where
col_22 >= ‘2022-01-01 00:00:00’
group by
col_12,
col_23) b
where
b.cnt_zb > a.cnt_zb )+ 1)<= 10
order by a.cnt_zb desc ;
