Query editor
WITH collections AS (SELECT * FROM (VALUES('ethereum', from_hex('7492e30d60d96c58ed0f0dc2fe536098c620c4c0'), 'Rainbow Zorb'),('ethereum', from_hex('f25298fa62a2eb94fc06626966f6f21399b4c508'), 'Rainbow Poolboy'),('ethereum', from_hex('c5f18a7bf825c2b0433102da5bc79c9edfc3fa89'), 'Rainbow Finiliar'),('ethereum', from_hex('6d60e6c4038b20cbba263ff842fec852f0550041'), 'Very Wow Golden Rainbow (Doge V2)'),('ethereum', from_hex('86fa5a5927fbaa82218743607765ec0f63e46bfa'), 'Rainbow Pooly'),('optimism', from_hex('81b30ff521d1feb67ede32db726d95714eb00637'), 'Optimistic Explorer'),('arbitrum', from_hex('a1e417c09211b9ec12ea25f97429d0772749bbf2'), 'Rainbow Smol'),('base', from_hex('6fac772b0d65e475ce22288c066a1b4ea06c4223'), 'Rainbow Baggy'),('base', from_hex('0x87073e9a3f85bb59821bb01acf0e8fde92891e4e'), 'RainbowWorld'),('base', from_hex('76843c8f8a369d29c719141a065ff561abe2420b'), 'Rainbowcast'),('base', from_hex('8c3f001a893f3b561dbcaa80f075ecc7a5b92690'), 'Redacted Rainbow'),('base', from_hex('A19d830dA98892343FE650E77ED8a1bABf4DEAcB'), 'The Chonkiest Icon'),('base', from_hex('0xf460cB40243B7562D9393383A0C6301e4C542D1b'), 'Rainbow Mogs'),('zora', from_hex('12e4527e2807978a49469f8d757abf5e07b32b8f'), 'Rainbow Zorb Energy')) AS t(blockchain, contract_address, collection_name)),xfers AS (SELECT 'ethereum' AS blockchain, t.contract_address, t."tokenId" AS token_id, t."to" AS owner,t.evt_block_time, t.evt_indexFROM erc721_ethereum.evt_Transfer tJOIN collections c ON c.blockchain='ethereum' AND t.contract_address=c.contract_addressUNION ALLSELECT 'optimism', t.contract_address, t."tokenId", t."to", t.evt_block_time, t.evt_indexFROM erc721_optimism.evt_Transfer tJOIN collections c ON c.blockchain='optimism' AND t.contract_address=c.contract_addressUNION ALLSELECT 'arbitrum', t.contract_address, t."tokenId", t."to", t.evt_block_time, t.evt_indexFROM erc721_arbitrum.evt_Transfer tJOIN collections c ON c.blockchain='arbitrum' AND t.contract_address=c.contract_addressUNION ALLSELECT 'base', t.contract_address, t."tokenId", t."to", t.evt_block_time, t.evt_indexFROM erc721_base.evt_Transfer tJOIN collections c ON c.blockchain='base' AND t.contract_address=c.contract_addressUNION ALLSELECT 'zora', t.contract_address, t."tokenId", t."to", t.evt_block_time, t.evt_indexFROM erc721_zora.evt_Transfer tJOIN collections c ON c.blockchain='zora' AND t.contract_address=c.contract_address),last_owner AS (SELECT blockchain, contract_address, token_id, owner,ROW_NUMBER() OVER (PARTITION BY blockchain, contract_address, token_idORDER BY evt_block_time DESC, evt_index DESC) rnFROM xfersWHERE owner <> 0x0000000000000000000000000000000000000000)SELECTl.owner,COUNT(*) AS total_tokens,COUNT(DISTINCT c.collection_name) AS collections_held,array_join(array_sort(array_distinct(array_agg(c.collection_name))),', ') AS collections_list