Updated 2022-08-09
    with tab1 AS
    (select
    BLOCK_TIMESTAMP::date as day,
    median(SUPPLIED_USD ) as wbtc_supply
    from flipside_prod_db.aave.deposits
    where AAVE_VERSION = 'Aave V2'
    and SYMBOL = 'WBTC'
    group by 1),

    tab2 as(
    select
    BLOCK_TIMESTAMP::date as days,
    sum(BORROWED_USD ) as usdc_borrows
    from flipside_prod_db.aave.borrows
    where AAVE_VERSION = 'Aave V2'
    and SYMBOL = 'USDC'
    group by 1
    )

    SELECT
    wbtc_supply,
    usdc_borrows,
    day
    from tab1
    join tab2 on tab1.day = tab2.days


    Run a query to Download Data