with ASA as
(select count(distinct(swap_to_asset_id)) as number,
swapper
from algorand.swaps
where block_timestamp >= '2022-01-01' AND
swap_to_amount > 1
group by swapper)
select
count(number) as frequency,
case
when number between 1 and 1 then '1'
when number between 2 and 10 then '2-10'
when number between 11 and 20 then '11-20'
when number between 21 and 30 then '21-30'
when number between 31 and 40 then '31-40'
else '41+'
end as segments
from ASA
group by segments
order by segments ASC