with tab1 as (select distinct voter as voter, count(distinct tx_hash) as "Voting Count", avg(voting_power)/pow(10,18) as "Average Voting Power"
from ethereum.aave.ez_votes
group by 1
order by 1),
tab2 as (select block_timestamp, BORROWER_ADDRESS, BORROWED_USD, symbol, tx_hash
from ethereum.aave.ez_borrows)
select voter, count(distinct tx_hash) as "⭐Borrow Count", sum(BORROWED_USD) as "Borrow Volume", "Voting Count", "Average Voting Power"
from tab1 left join tab2 on tab1.voter=tab2.BORROWER_ADDRESS
where BORROWED_USD is not null and symbol<>'REP'
group by 1,4,5
order by 2 desc
limit 10