kiacryptoPortals holders distribution
    Updated 2022-07-20
    with holders as (
    select tx_to as address, '+1' as hold_count
    from solana.core.fact_transfers join solana.core.dim_labels on address = mint
    where label = 'portals'
    union all

    select tx_from as address, '-1' as hold_count
    from solana.core.fact_transfers join solana.core.dim_labels on address = mint
    where label = 'portals'
    ),
    hold_count as (
    select address, sum(hold_count) as NFTs_count
    from holders
    group by 1 having NFTs_count > 0
    )

    select case
    when NFTs_count = 1 then '1'
    when NFTs_count = 2 then '2'
    when NFTs_count > 2 and NFTs_count <= 4 then '3 - 4'
    when NFTs_count > 4 and NFTs_count <= 8 then '5 - 8'
    when NFTs_count > 8 and NFTs_count <= 16 then '9 - 16'
    when NFTs_count > 16 and NFTs_count <= 32 then '17 - 32'
    else 'more than 32' end as dis, count(*)
    from hold_count
    group by 1
    Run a query to Download Data