Pmisha-bmlMdxhold.dist.goose
    Updated 2022-06-10
    with NFTs as (SELECT
    asset_id
    from algorand.asset
    where total_supply = 1
    and decimals = 0
    and asset_deleted = 'False'
    and asset_name ilike '%CGF%'),

    ds as (select
    distinct address as ww
    from flipside_prod_db.algorand.account_asset
    where ASSET_ID in (select ASSET_ID from NFTs)
    and amount>0
    )
    select
    case
    when balance between 0 and 10 then 'a. 0-10'
    when balance between 11 and 100 then 'b. 11-100'
    when balance between 101 and 500 then 'c. 101-500'
    when balance between 501 and 2000 then 'd. 501-2000'
    when balance> 2000 then 'e. over 2000'
    end as buckets,
    count(distinct ADDRESS) as users
    from flipside_prod_db.algorand.account
    where ADDRESS in (select ww from ds)
    group by 1 having buckets is not null




    Run a query to Download Data