rezaramshiniUntitled Query
Updated 2022-07-18Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
›
⌄
with a as (
select BLOCK_TIMESTAMP, payer, ROW_NUMBER() OVER (partition by payer order by BLOCK_TIMESTAMP) as number_of_tx from flow.core.fact_transactions
where block_timestamp::date>CURRENT_DATE-35 )
,
first_tx as (
select BLOCK_TIMESTAMP as first_transaction, payer from a
where number_of_tx=1)
,
second_tx as (
select BLOCK_TIMESTAMP as second_transaction,payer from a
where number_of_tx=2)
select first_tx.payer, DATEDIFF(day,first_transaction, second_transaction ) as Intervall
from first_tx join second_tx on first_tx.payer=second_tx.payer
-- group by 1
Run a query to Download Data