Query editor
WITH latest_owner AS (SELECT"tokenId" AS token_id,"to" AS owner,ROW_NUMBER() OVER (PARTITION BY "tokenId" ORDER BY evt_block_time DESC, evt_index DESC) AS rnFROM erc721_ethereum.evt_TransferWHERE contract_address = 0x9dc39b51782d13e3d6a350553107089eacc0b336),holdings AS (SELECT owner, COUNT(*) AS token_countFROM latest_ownerWHERE rn = 1 AND owner != 0x0000000000000000000000000000000000000000GROUP BY owner),ranked AS (SELECT owner, token_count, NTILE(10) OVER (ORDER BY token_count DESC) AS decileFROM holdings)SELECTCOUNT(*) AS total_holders,ROUND(AVG(token_count), 2) AS avg_holding,MAX(token_count) AS max_holding,ROUND(SUM(CASE WHEN decile = 1 THEN token_count END) * 100.0 / SUM(token_count), 2) AS top10pct_share,ROUND(SUM(CASE WHEN token_count = 1 THEN 1 END) * 100.0 / COUNT(*), 2) AS single_holder_pctFROM ranked;