mariyaLet it burn!
    Updated 2022-04-27
    WITH sales as (
    SELECT PURCHASER, SUM(SALES_AMOUNT) total_sales, COUNT(*) AS sale_count
    FROM solana.fact_nft_sales
    WHERE SUCCEEDED = 'TRUE'
    AND DATE(BLOCK_TIMESTAMP) >= '2022-03-01' and marketplace = 'magic eden v2' or marketplace = 'magic eden v1' and SUCCEEDED = 'TRUE'
    GROUP BY PURCHASER
    )
    ,
    TOP_20_SALES as ( SELECT top 10 *
    FROM sales
    where sale_count >= 50
    ORDER BY total_sales DESC
    )
    ,
    sales_mints as (
    SELECT mint, SALES_AMOUNT , tx_id, PURCHASER
    FROM solana.fact_nft_sales
    WHERE SUCCEEDED = 'TRUE'
    AND DATE(BLOCK_TIMESTAMP) >= '2022-03-01'
    AND PURCHASER IN(
    SELECT PURCHASER from TOP_20_SALES
    )
    )
    ,
    sales_mints as (
    SELECT mint , SALES_AMOUNT , tx_id, PURCHASER
    FROM solana.fact_nft_sales
    WHERE SUCCEEDED = 'TRUE'
    AND DATE(BLOCK_TIMESTAMP) >= '2022-03-01' AND marketplace = 'magic eden v1' or marketplace = 'magic den v2'
    AND PURCHASER IN(
    SELECT PURCHASER from top_20_sales
    )
    )
    ,
    final_result as ( select t1.mint, SALES_AMOUNT, tx_id, PURCHASER , ADDRESS_NAME as Collection
    from sales_mints t1
    Run a query to Download Data