SniperUntitled Query
    Updated 2022-10-10
    WITH tab1 as (
    SELECT
    -- date_trunc('week', block_timestamp) as week,
    label,
    count(DISTINCT tx_id) as events,
    count(DISTINCT INSTRUCTION:accounts[1]) as users
    FROM solana.core.fact_events
    LEFT outer JOIN solana.core.dim_labels
    on program_id = address
    WHERE label_type IN ('dex', 'defi')
    AND block_timestamp > '2022-09-01'
    GROUP BY 1--, 2
    ORDER by 2 DESC
    LIMIT 15
    --ORDER by 2 DESC
    --LIMIT 10
    )

    SELECT
    date_trunc('day', block_timestamp) as day,
    label,
    count(DISTINCT tx_id) as events,
    count(DISTINCT INSTRUCTION:accounts[1]) as users
    FROM solana.core.fact_events
    LEFT outer JOIN solana.core.dim_labels
    on program_id = address
    WHERE label_type IN ('dex', 'defi')
    AND block_timestamp > '2022-09-01'
    AND label in (SELECT label from tab1)
    GROUP BY 1, 2


    Run a query to Download Data