Updated 2023-02-03
    WITH sell AS(
    SELECT
    seller_address AS sellers,
    COUNT (DISTINCT TX_HASH) AS TX_Count,
    COUNT (DISTINCT TOKENID) AS Tokens_Count,
    sum (price_usd) AS USDPrice,
    sum (price) AS EthPrice
    FROM ethereum.core.ez_nft_sales
    WHERE SELLER_ADDRESS != '0x0000000000000000000000000000000000000000'
    AND PRICE is not null AND PRICE_USD is not null AND EVENT_TYPE='sale'
    AND NFT_ADDRESS='0xccdf1373040d9ca4b5be1392d1945c1dae4a862c' --contract

    GROUP BY 1
    )
    ,buy AS(
    SELECT
    buyer_address AS buyers,
    COUNT (DISTINCT TX_HASH) AS TX_Count,
    COUNT (DISTINCT TOKENID) AS Tokens_Count,
    sum (price_usd) AS USDPrice,
    sum (price) AS EthPrice
    FROM ethereum.core.ez_nft_sales
    WHERE BUYER_ADDRESS != '0x0000000000000000000000000000000000000000'
    AND price is not null AND PRICE_USD is not null AND EVENT_TYPE='sale'
    AND NFT_ADDRESS='0xccdf1373040d9ca4b5be1392d1945c1dae4a862c' --contract

    GROUP BY 1
    )
    SELECT sellers AS userr ,
    sum(s.USDPrice - b.USDPrice) AS USD_Profit,
    sum(s.EthPrice - b.EthPrice) AS ETH_Profit
    FROM sell s INNER JOIN buy b ON b.buyers = s.sellers
    GROUP BY 1
    Run a query to Download Data