Query editor
WITH token_inflows AS (SELECTt.to_owner AS address, -- Receiving wallet addressSUM(t.amount) AS total_inflows -- Sum of tokens received by the walletFROM tokens_solana.transfers AS tWHEREt.token_mint_address = 'eL5fUxj2J4CiQsmW85k5FG9DvuQjjUoBHoQBi2Kpump' -- Meme token's mint addressAND t.amount > 0 -- Ensure only positive inflows are countedGROUP BYt.to_owner), token_outflows AS (SELECTt.from_owner AS address, -- Sending wallet addressSUM(t.amount) AS total_outflows -- Sum of tokens sent by the walletFROM tokens_solana.transfers AS tWHEREt.token_mint_address = 'eL5fUxj2J4CiQsmW85k5FG9DvuQjjUoBHoQBi2Kpump' -- Meme token's mint addressAND t.amount > 0 -- Ensure only positive outflows are countedGROUP BYt.from_owner), token_holders AS (SELECTi.address,i.total_inflows - COALESCE(o.total_outflows, 0) AS net_tokens_held -- Net token balance (inflows - outflows)FROM token_inflows AS iLEFT JOIN token_outflows AS oON i.address = o.address)SELECTCOUNT(DISTINCT address) AS holder_count -- Count distinct wallet addresses holding at least 1 tokenFROM token_holdersWHERE net_tokens_held > 0 -- Only count wallets with positive token balances