Updated 2022-05-04
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
›
⌄
with anc as (select
date,
sum(balance) as circulating,
sum(circulating)over(order by date asc) as cumulative_ust
from terra.daily_balances
where CURRENCY='UST'
and date<=CURRENT_DATE-3
and date>= '2022-01-01'
group by 1),
ancnot as(select
date,
sum(balance) as circulating_without,
sum(circulating_without)over(order by date asc) as cumulative_ust_without
from terra.daily_balances
where CURRENCY='UST'
and date<=CURRENT_DATE-3
and date>= '2022-01-01'
and address!='terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
group by 1)
SELECT
anc.date as dt,
circulating,
circulating_without,
cumulative_ust,
cumulative_ust_without
from anc
inner join ancnot on anc.date=ancnot.date
Run a query to Download Data