SalehForefront Holder Distribution-Grouping
    Updated 2022-03-30
    with lst_all as (
    select user_address,
    sum(balance) as FF_amount,
    case
    when FF_amount <= 1 then 'FF amount <= 1'
    when FF_amount > 1 and FF_amount < 10 then 'FF amount > 1 and < 10'
    when FF_amount >= 10 and FF_amount < 20 then 'FF amount >= 10 and < 20'
    when FF_amount >= 20 and FF_amount < 30 then 'FF amount >= 20 and < 30'
    when FF_amount >= 30 and FF_amount < 40 then 'FF amount >= 30 and < 40'
    when FF_amount >= 40 and FF_amount < 50 then 'FF amount >= 40 and < 50'
    when FF_amount >= 50 and FF_amount < 60 then 'FF amount >= 50 and < 60'
    when FF_amount >= 60 and FF_amount < 70 then 'FF amount >= 60 and < 70'
    when FF_amount >= 70 and FF_amount < 80 then 'FF amount >= 70 and < 80'
    when FF_amount >= 80 and FF_amount < 90 then 'FF amount >= 80 and < 90'
    when FF_amount >= 90 and FF_amount < 10 then 'FF amount >= 80 and < 90'
    when FF_amount >= 100 and FF_amount < 1000 then 'FF amount >= 100 and < 1K'
    else 'FF amount >= 1K'
    end as FF_amount_group
    from ethereum.erc20_balances
    where contract_address = '0x7e9d8f07a64e363e97a648904a89fb4cd5fb94cd'
    and balance_date = current_date - 1
    group by 1)

    select FF_amount_group
    ,sum(FF_amount) as FF_amount
    ,count(distinct(user_address)) as user_count
    from lst_all
    group by 1
    order by 1

    Run a query to Download Data