mattkstewPine badge v2 balance copy copy
    -- forked from Pine badge v2 balance copy @ https://flipsidecrypto.xyz/edit/queries/5ce6cab4-7077-4a50-9baa-bddc9098801f

    -- forked from jackguy / Pine badge v2 balance @ https://flipsidecrypto.xyz/jackguy/q/4k3xhUtqR16D/pine-badge-v2-balance
    with tab1 as (
    SELECT
    NFT_TO_ADDRESS as holder,
    tokenid,
    sum(
    CASE when NFT_FROM_ADDRESS LIKE '0x0000000000000000000000000000000000000000' then ERC1155_VALUE
    when NFT_TO_ADDRESS LIKE '0x0000000000000000000000000000000000000000' then -1 * ERC1155_VALUE
    end
    ) as token_amt
    from polygon.core.ez_nft_transfers
    WHERE NFT_ADDRESS LIKE lower('0xfaa85a0903985baaf3ba9ede37db6b9e325630b7')
    GROUP BY 1,2
    )

    select
    Holder,


    from tab1



    Run a query to Download Data