StangFAST07.01 - types of active days
    Updated 2023-05-11
    -- forked from 07 - types of active days @ https://flipsidecrypto.xyz/edit/queries/7cb0cd86-2817-40e2-8dbb-e19654087892

    with

    NEAR_users AS
    (
    SELECT
    min( a.block_timestamp ) AS min_date
    , a.trader AS users
    FROM
    near.core.ez_dex_swaps a
    GROUP BY
    2
    )

    ,

    active AS
    (
    SELECT
    a.trader AS users
    , count( DISTINCT date_trunc( 'day' , a.block_timestamp ) ) AS active_days
    FROM
    near.core.ez_dex_swaps a
    JOIN
    NEAR_users b
    ON a.trader = b.users
    GROUP BY
    1
    )

    SELECT
    date_trunc( 'week' , b.block_timestamp ) AS date
    , count( DISTINCT( users ) ) AS users
    , CASE
    when active_days = 1 then 'a : 1 day'
    Run a query to Download Data