thirdtime_ianzed holders
Updated 2024-08-04
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- Step 1: Combine incoming and outgoing transfers for the Zed Run horse NFTs
WITH transfers AS (
-- Select all incoming transfers (NFTs sent to an address)
SELECT
nft_to_address AS address, -- The address receiving the NFT
COUNT(tokenid) AS balance_change -- Count of NFTs received (positive balance change)
FROM
POLYGON.nft.ez_nft_transfers
WHERE
nft_address = '0x67f4732266c7300cca593c814d46bee72e40659f' -- Filter by Zed Run horse NFT contract address
GROUP BY
nft_to_address -- Group by receiving address
UNION ALL
-- Select all outgoing transfers (NFTs sent from an address)
SELECT
nft_from_address AS address, -- The address sending the NFT
-COUNT(tokenid) AS balance_change -- Count of NFTs sent (negative balance change)
FROM
POLYGON.nft.ez_nft_transfers
WHERE
nft_address = '0x67f4732266c7300cca593c814d46bee72e40659f' -- Filter by Zed Run horse NFT contract address
GROUP BY
nft_from_address -- Group by sending address
),
-- Step 2: Calculate the net balance of NFTs for each address
balances AS (
SELECT
address, -- The address involved in the transfers
SUM(balance_change) AS net_balance -- Sum of balance changes to get the net balance
FROM
transfers
GROUP BY
address -- Group by address to get the net balance per address
)
QueryRunArchived: QueryRun has been archived