legionUntitled Query
    Updated 2022-10-14
    WITH tab1 as (
    SELECT
    'Arbitrum' as block_chain,
    count(DISTINCT origin_from_address) as users,
    sum (amount_in_usd) as volume,
    count(DISTINCT tx_hash) as txs
    from arbitrum.sushi.ez_swaps
    WHERE block_timestamp > '2022-01-01'
    GROUP BY 1
    ), tab2 as (
    SELECT
    'Optimism' as block_chain,
    count(DISTINCT origin_from_address) as users,
    sum (amount_in_usd) as volume,
    count(DISTINCT tx_hash) as txs
    from optimism.sushi.ez_swaps
    WHERE block_timestamp > '2022-01-01'
    GROUP BY 1
    ), tab3 as (
    SELECT
    'Polygon' as block_chain,
    count(DISTINCT origin_from_address) as users,
    sum (amount_in_usd) as volume,
    count(DISTINCT tx_hash) as txs
    FROM polygon.sushi.ez_swaps
    WHERE block_timestamp > '2022-01-01'
    GROUP BY 1
    )

    SELECT *
    from tab1
    UNION ALL
    SELECT *
    from tab2
    UNION ALL
    SELECT *
    Run a query to Download Data