Query editor
/*Query outputs wallet addresses of NFT owners and their NFT balances for the target collection*/WITH/*1. Fetching all transfers per NFT.For each NFT transfer, adding its order within all transfers of this specific NFT.E.g. "1" means that this transfer was the latest for this NFT etc.*/ranked_transfers AS (SELECTtokenId AS token_id,"to" AS current_owner,ROW_NUMBER() OVER (PARTITION BY tokenId ORDER BY evt_block_time DESC) AS rnFROM erc721_{{blockchain}}.evt_transferWHERE contract_address = {{nft_contract_address}}),/*2. Fetching current owners of the NFTs of the target collectionOwner of a specific NFT is defined as the recipient address of the latest transfer of this NFT.*/current_owners AS (SELECTcurrent_owner,token_idFROM ranked_transfersWHERE rn=1)/*Finally, selecting all current NFT owners and how many NFTs of the target collection they own.*/SELECTcurrent_owner,COUNT(token_id) AS token_cntFROM current_ownersGROUP BY current_ownerHAVING current_owner NOT IN ({{owners_to_ignore}})ORDER BY COUNT(token_id) DESC