davidwallMoonbirds -34
    Updated 2022-05-09
    WITH firsttable as(SELECT *
    FROM ethereum_core.ez_nft_transfers
    JOIN (
    SELECT tokenid as tk,
    nft_to_address as to_nft,
    tx_hash as last_tx,
    row_number() OVER (PARTITION BY tokenid ORDER BY block_timestamp DESC) as RN
    FROM ethereum_core.ez_nft_transfers
    WHERE nft_address = '0x23581767a106ae21c074b2276d25e5c3e136a68b'
    ) temp on ethereum_core.ez_nft_transfers.tokenid = temp.tk and ethereum_core.ez_nft_transfers.nft_to_address = temp.to_nft and RN =1
    and tx_hash = temp.last_tx
    WHERE nft_address = '0x23581767a106ae21c074b2276d25e5c3e136a68b'),secondtable as (
    SELECT *
    FROM ethereum_core.ez_nft_transfers
    JOIN (
    SELECT
    project_name as pj,
    tokenid as tk,
    nft_to_address as to_nft,
    tx_hash as last_tx,
    row_number() OVER (PARTITION BY project_name,tokenid ORDER BY block_timestamp DESC) as RN
    FROM ethereum_core.ez_nft_transfers
    where project_name !='opensea'
    ) temp on tx_hash = temp.last_tx and ethereum_core.ez_nft_transfers.tokenid = temp.tk and ethereum_core.ez_nft_transfers.nft_to_address = temp.to_nft and RN =1
    and project_name =pj and nft_to_address in (select nft_to_address from firsttable))
    select project_name,count(nft_to_address) as moonbirds_common_holder
    from secondtable
    group by 1 order by 2 desc


    Run a query to Download Data