mattkstewTerradash 1
Updated 2022-12-20Copy Reference Fork
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 tab1 as (
select
min(date_trunc('week', block_timestamp)) as date1,
message_value:contract
from terra.core.ez_messages
where message_type like '%Contract%'
group by 2
)
, tab2 as
(
select
date1,
count(*) as amount
from tab1
group by 1
)
, tab3 as
(
select
date1,
(sum(amount) Over (Order by date1)) as moving_total
from tab2
)
select *
from tab2 left outer join tab3 on tab2.date1 = tab3.date1
Run a query to Download Data