with
borrow as (
select tx_id,Block_TimeStamp ::DATE Block_TimeStamp,borrowed_usd volume from aave.borrows where block_timestamp::date > current_date-365
)
,rpborrow as (
select month( ts.Block_TimeStamp)month,monthname( ts.Block_TimeStamp)month_name ,avg(volume) as volume ,avg(gas_price)/1e9 as av_gas from
ethereum.transactions ts
JOIN
borrow
on ts.tx_id=borrow.tx_id
group by month,month_name
)
select * from rpborrow order by month