Q&A about the site for serious players and enthusiasts of chess
with x as ( select id, type, count(1) cnt from ( select 1 id, 'upmod' type union all select 1, 'upmod' union all select 1, 'upmod' union all select 2, 'upmod' union all select 2, 'upmod' union all select 3, 'upmod' union all select 3, 'upmod' union all select 3, 'upmod' ) s group by id, type) select rank() over (partition by type order by cnt), type, cnt from x