with tab1 as (
select
FROM_ADDRESS as "User Address",
count(POOL_NAME) as "# Pools"
from thorchain.defi.fact_swaps
where 1=1
and POOL_NAME is not NULL
group by 1
)
select
case when "# Pools" = 1 then 'A: 1'
when "# Pools" = 2 then 'B: 2'
when "# Pools" = 3 then 'C: 3'
when "# Pools" = 4 then 'D: 4'
when "# Pools" = 5 then 'E: 5'
else 'F: > 5'
end as "# Pools Bin",
count("User Address") as "# Users"
from tab1
group by 1
order by "# Users" desc