with tot as (select
t.tx_fee, b.*
from ethereum.sushi.ez_borrowing b , ethereum.core.fact_transactions t
where LENDING_POOL ilike 'km%'
and b.tx_hash = t.tx_hash )
select
date_trunc(day,BLOCK_TIMESTAMP)::date as days,
LENDING_POOL,
ACTION ,
sum(TX_FEE) as tx_fee
from tot
group by 1,2,3