select table1.supply_amount, table2.borrow_rate, table2.date_time
from (select avg(total_liquidity_token) as supply_amount,
date_trunc('WEEK', block_hour) as date_time
from flipside_prod_db.aave.market_stats ms
where date_time >= '2021-01-01'
and ms.reserve_name like 'WBTC'
and ms.aave_version ilike '%AAVE V2%'
group by date_time) as table1 join (select 100 * avg(borrow_rate_stable) as borrow_rate,
reserve_name as token,
date_trunc('WEEK', block_hour) as date_time
from flipside_prod_db.aave.market_stats
where date_time >= '2021-01-01'
and aave_version ilike '%AAVE V2%'
and token like 'USDC'
group by date_time, token) as table2
on table1.date_time = table2.date_time