adambalaUntitled Query
Updated 2022-12-07Copy 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
31
32
33
34
35
36
›
⌄
with
first_tx as (
select
tx_from,
min(block_timestamp)::date as date_first
from terra.classic.fact_transactions txs
where tx_status = 'SUCCEEDED'
and exists (select 1 from terra.classic.fact_transactions txs_tf
where tx_status = 'SUCCEEDED'
and block_timestamp > date('2022-05-12') - interval '90 days'
and block_id <= 7603700
and txs_tf.tx_from = txs.tx_from
)
group by 1
),
txs_classic as (
select
date_trunc('week',block_timestamp) as date,
case
when date = date_first then 'NEW'
else 'EXISTING'
end as label,
count(distinct tx_from) as users
from terra.classic.fact_transactions txs
left join first_tx
using (tx_from)
where tx_status = 'SUCCEEDED'
Run a query to Download Data