re_annP2-QUERY1
    Updated 2024-04-14
    -- Define the CTE to select and aggregate necessary sales data
    WITH ProjectSalesSummary AS (
    SELECT
    PROJECT_NAME,
    SUM(PRICE) AS TOTAL_SALES_ETH,
    SUM(PRICE_USD) AS TOTAL_SALES_USD,
    SUM(CREATOR_FEE) AS TOTAL_CREATOR_FEES_ETH,
    SUM(CREATOR_FEE_USD) AS TOTAL_CREATOR_FEES_USD
    FROM ethereum.nft.ez_nft_sales
    WHERE BLOCK_TIMESTAMP BETWEEN '2024-04-01 00:00:00' AND '2024-04-30 23:59:59'
    GROUP BY PROJECT_NAME
    )
    -- Select the aggregated results from the CTE
    SELECT
    PROJECT_NAME,
    TOTAL_SALES_ETH,
    TOTAL_SALES_USD,
    TOTAL_CREATOR_FEES_ETH,
    TOTAL_CREATOR_FEES_USD
    FROM ProjectSalesSummary
    ORDER BY TOTAL_SALES_USD DESC;

    QueryRunArchived: QueryRun has been archived