with anchor_deposit as (select
date_trunc('day', block_timestamp) as day,
sum(deposit_amount) as deposit_anchor
from anchor.deposits
where block_timestamp > CURRENT_DATE - 90
group by 1),
ust as(SELECT
date as day,
sum(BALANCE) as total_ust
from terra.daily_balances
where CURRENCY='UST'
and date > CURRENT_DATE - 90
group by 1)
select
anchor_deposit.day as day,
deposit_anchor,
total_ust,
total_ust-deposit_anchor as UST_despite_anchor
from anchor_deposit
inner join ust on anchor_deposit.day=ust.day