Moeteract3
Updated 2023-02-01
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 txs as (select
*
from
(select
BLOCK_TIMESTAMP,
TX_SENDER,
row_number()over(partition by TX_SENDER order by BLOCK_TIMESTAMP) as row_n
from terra.core.fact_transactions
) where row_n < 3 )
, first_tx as (select
TX_SENDER,
BLOCK_TIMESTAMP as first_tx
from txs where row_n = 1
)
,scnd_tx as (select
TX_SENDER,
BLOCK_TIMESTAMP as scnd_tx
from txs where row_n = 2
)
,time_diff as (select
t.TX_SENDER,
first_tx,
scnd_tx,
DATEDIFF(day,first_tx, scnd_tx ) as time_dif
from first_tx t join scnd_tx v on t.TX_SENDER = v.TX_SENDER
)
select
CASE
Run a query to Download Data