Query editor
WITH price AS (SELECTprice,decimalsFROM prices.usd_latestWHEREcontract_address = 0x92D6C1e31e14520e676a687F0a93788B716BEff5AND blockchain = 'ethereum'), balance AS (SELECT"from" AS address,(-1) * SUM(TRY_CAST(value AS DOUBLE)) / 1e18 AS amountFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x92D6C1e31e14520e676a687F0a93788B716BEff5GROUP BY1UNION ALLSELECT"to" AS address,SUM(TRY_CAST(value AS DOUBLE)) / 1e18 AS amountFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x92D6C1e31e14520e676a687F0a93788B716BEff5GROUP BY1)selectcasewhen percent_holdings >=0.5 then 'H) Holdings >=50%'when percent_holdings >=0.4 and percent_holdings<0.5 then 'G) Holdings >=40% & <50%'when percent_holdings >=0.3 and percent_holdings<0.4 then 'F) Holdings >=30% & <40%'when percent_holdings >=0.2 and percent_holdings<0.3 then 'E) Holdings >=20% & <30%'when percent_holdings >=0.1 and percent_holdings<0.2 then 'D) Holdings >=10% & <20%'when percent_holdings >=0.05 and percent_holdings<0.1 then 'C) Holdings >=5% & <10%'when percent_holdings >=0.01 and percent_holdings<0.05 then 'B) Holdings >=1% & <5%'when percent_holdings <0.01 then 'A) Holdings <1%'end as distribution,count(distinct address) as address_count,sum(holding) as total_holdingfrom (selectaddress,sum(amount) as holding,sum(amount*price) as holding_usd,sum(amount)/1000000000 as percent_holdingsfrom price, balancewhere address not in (0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000dEaD)group by 1)awhere holding_usd>1group by 1