headitmanagerBuys' Total Price
    Updated 2022-06-04
    with tblmint as (select PURCHASER,mint,sum(mint_price) as pmint from flipside_prod_db.solana.fact_nft_mints
    where year(block_timestamp)=2022 and SUCCEEDED='TRUE' and mint_currency='So11111111111111111111111111111111111111111'
    group by 1,2)
    , tblsales as (select mint, sum(SALES_AMOUNT) as psale from flipside_prod_db.solana.fact_nft_sales
    where year(block_timestamp)=2022 and SUCCEEDED='TRUE'
    group by 1)
    , address as (select sum(psale-pmint) as profit , tblmint.PURCHASER as users from tblmint inner join tblsales
    on tblmint.mint=tblsales.mint
    group by 2
    order by profit desc
    limit 20)
    , mint_amount as (select sum(mint_price),PURCHASER from flipside_prod_db.solana.fact_nft_mints
    where year(block_timestamp)=2022 and SUCCEEDED='TRUE' and PURCHASER in( select users from address)
    and mint_currency='So11111111111111111111111111111111111111111'
    group by PURCHASER)
    , buy_amount as (select sum(sales_amount),PURCHASER from flipside_prod_db.solana.fact_nft_sales
    where year(block_timestamp)=2022 and SUCCEEDED='TRUE' and PURCHASER in( select users from address)
    group by PURCHASER)
    select * from buy_amount
    Run a query to Download Data