Query editor
WITHsender as (SELECTtx."from" as account, tx.to as tx_to, cast(tx.value as double)/1e18 as mon_valueFROM monad_testnet.transactions txWHERE tx.successAND tx.to NOT IN (SELECT addressFROM monad_testnet.creation_traces)AND tx."from" NOT IN (SELECT DISTINCT "from"FROM monad_testnet.transactionsWHERE to IN (SELECT DISTINCT addressFROM monad_testnet.creation_traces))AND tx."from" IN (SELECT accountFROM query_5652905)), agg_stat as (SELECTaccount, count(distinct tx_to) as address_sent_to, sum(mon_value) as total_mon_sentFROM senderGROUP BY 1), levl as (SELECTaddress_sent_to, total_mon_sent, case when total_mon_sent <= 100 then 'tier1' when total_mon_sent > 100 and total_mon_sent <= 1000 then 'tier2'when total_mon_sent > 1000 and total_mon_sent <= 10000 then 'tier3'when total_mon_sent > 10000 and total_mon_sent <= 50000 then 'tier4' else 'tier5' end as levFROM agg_stat gWHERE total_mon_sent > 1AND address_sent_to > 1ORDER BY address_sent_to DESC), comb_ as (SELECTcase when lev = 'tier1' then 'tier1: sent out <= 100 MON' when lev = 'tier2' then 'tier2: sent out 100 - 1000 MON'when lev = 'tier3' then 'tier3: sent out 1000 - 10000 MON'when lev = 'tier4' then 'tier4: gave out 10000 - 50000 MON' else 'tier5: more than 50000 MON' end as tier, sum(case when lev = 'tier1' then address_sent_to else 0 end) as tier1, sum(case when lev = 'tier2' then address_sent_to else 0 end) as tier2, sum(case when lev = 'tier3' then address_sent_to else 0 end) as tier3, sum(case when lev = 'tier4' then address_sent_to else 0 end) as tier4, sum(case when lev = 'tier5' then address_sent_to else 0 end) as tier5, sum(case when lev = 'tier1' then total_mon_sent else 0 end) as amount1, sum(case when lev = 'tier2' then total_mon_sent else 0 end) as amount2, sum(case when lev = 'tier3' then total_mon_sent else 0 end) as amount3, sum(case when lev = 'tier4' then total_mon_sent else 0 end) as amount4, sum(case when lev = 'tier5' then total_mon_sent else 0 end) as amount5FROM levlGROUP BY 1