Query editor
/* ===================================================STAGE 1c SUMMARY: per country, from dune.boc.result_payout_walletsDecides whether Stage 1d is worth running: if few payout wallets areflagged, or they pay few wallets, skip it.=================================================== */SELECTcountry,COUNT(*) AS candidates,COUNT_IF(is_payout) AS payout_wallets,SUM(CASE WHEN is_payout THEN n_recipients END) AS payout_recipients_upper_bound,approx_percentile(CASE WHEN is_payout THEN n_recipients END, 0.5) AS payout_median_recipients,SUM(CASE WHEN is_payout THEN withdraw_usd END) AS payout_usd_from_exchange,-- near misses, to judge the thresholdsCOUNT_IF(NOT is_payout AND share_in_from_exchange >= 0.9 AND n_recipients BETWEEN 20 AND 49) AS near_miss_20_49_recipientsFROM dune.boc.result_payout_walletsGROUP BY countryORDER BY payout_wallets DESC