Query editor
WITH latest_block AS (-- Get the latest block date to filter balances efficientlySELECT MAX(block_date) AS max_block_dateFROM solana.account_activity),latest_balances AS (-- Filter for wallets that have a positive balance for any token at the latest blockSELECTaddress AS wallet,token_mint_address,post_balanceFROM solana.account_activityWHERE block_date = (SELECT max_block_date FROM latest_block)AND post_balance > 0),wallets_never_sold AS (-- Select wallets that have never "sold" (been a from_owner in a transfer where amount > 0)SELECT DISTINCT from_owner AS walletFROM tokens_solana.transfersWHERE amount > 0)-- Count wallets that still have a balance and have never sold tokensSELECTCOUNT(DISTINCT lb.wallet) AS wallets_with_positive_balance,COUNT(DISTINCT lb.wallet) -COUNT(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM wallets_never_sold wnsWHERE wns.wallet = lb.wallet) THEN lb.wallet END) AS wallets_never_soldFROM latest_balances lb;