Anahitasocial
Updated 2023-03-16
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
base as
( SELECT
signer_id,
min(date_trunc('day', block_timestamp)) as first_day,
count(DISTINCT tx_hash) as profile_change_events
FROM near.social.fact_addkey_events
GROUP BY 1)
, txs as (select
tx_signer ,
min(block_timestamp) as fs_tx,
max(block_timestamp) as last_tx
from
near.core.fact_transactions
where
tx_signer in (select signer_id from base where first_day >= CURRENT_DATE - 90)
and BLOCK_TIMESTAMP > CURRENT_DATE - 180
group by 1)
, fin as (select
TX_SIGNER,
datediff(day,fs_tx,last_tx) as age_days
from txs
)
select
case
when age_days < 1 then 'less than 1 day'
when age_days between 1 and 7 then 'less than 1 week'
when age_days between 7 and 30 then 'less than 1 month'
Run a query to Download Data