how select top 3 count from, say, table below. know can done using combination of order by , rownum, want display in such way that:
if id count number same, id same count shall display together
id count ----------- ----------------- 4 b 2 c 3 d 2 e 1 i'm using sql plus
the easiest way dense_rank() analytic function:
select id, count (select t.*, dense_rank() on (order count desc) seqnum t ) t seqnum <= 3
Comments
Post a Comment