Query editor
WITH DailyCounts AS (SELECTDATE_TRUNC('day', day) AS date, -- Ensures dates are grouped by day without time'Ethereum' AS chain,COUNT(DISTINCT address) AS number_of_wallets -- Counts unique addresses with a balance greater than zeroFROM tokens_ethereum.balances_dailyWHEREtoken_address = 0x6b0b3a982b4634ac68dd83a4dbf02311ce324181 -- Ethereum ALI addressAND token_standard = 'erc20'AND balance > 0GROUP BY DATE_TRUNC('day', day)UNION ALLSELECTDATE_TRUNC('day', day) AS date,'Polygon' AS chain,COUNT(DISTINCT address) AS number_of_walletsFROM tokens_polygon.balances_dailyWHEREtoken_address =0xbfc70507384047aa74c29cdc8c5cb88d0f7213ac -- Polygon AddressAND token_standard = 'erc20'AND balance > 0GROUP BY DATE_TRUNC('day', day)UNION ALLSELECTDATE_TRUNC('day', day) AS date,'Base' AS chain,COUNT(DISTINCT address) AS number_of_walletsFROM tokens_base.balances_dailyWHEREtoken_address = 0x97c806e7665d3afd84a8fe1837921403d59f3dcc -- Base AddressAND token_standard = 'erc20'AND balance > 0GROUP BY DATE_TRUNC('day', day))SELECTdate,SUM(CASE WHEN chain = 'Ethereum' THEN number_of_wallets ELSE 0 END) AS ethereum_wallets,SUM(CASE WHEN chain = 'Polygon' THEN number_of_wallets ELSE 0 END) AS polygon_wallets,SUM(CASE WHEN chain = 'Base' THEN number_of_wallets ELSE 0 END) AS base_walletsFROM DailyCountsGROUP BY dateORDER BY date DESC;