nitsUntitled Query
Updated 2022-07-18Copy Reference Fork
999
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 f as
(SELECT payer as p , block_timestamp as bt , row_number() over (partition by payer order by block_timestamp) as rn
from flow.core.fact_transactions ),
e as
(SELECT from_address as p , block_timestamp as bt , row_number() over (partition by p order by block_timestamp) as rn
from ethereum.core.fact_transactions ),
s as
(SELECT signers[0] as p , block_timestamp as bt , row_number() over (partition by p order by block_timestamp) as rn
from solana.core.fact_transactions ),
av as
(SELECT from_address as p , block_timestamp as bt , row_number() over (partition by p order by block_timestamp) as rn
from avalanche.core.fact_transactions ),
b as
(SELECT from_address as p , block_timestamp as bt , row_number() over (partition by p order by block_timestamp) as rn
from bsc.core.fact_transactions ),
al as
(SELECT sender as p , block_timestamp as bt , row_number() over (partition by p order by block_timestamp) as rn
from algorand.transactions ),
flow_users as
(SELECT count(*) as total, sum(in_a_week) as total_in_a_week
, sum(in_a_month) as total_in_a_month,
total_in_a_week/total*100 as percent_in_a_week,
total_in_a_month/total*100 as percent_in_a_month, 'flow' as chain
from
(SELECT *, case when TIMESTAMPDIFF(SQL_TSI_DAY, block_timestamp, bt) < 7 then 1 else 0 end as in_a_week
, case when TIMESTAMPDIFF(SQL_TSI_DAY, block_timestamp, bt) < 30 then 1 else 0 end as in_a_month
from
(SELECT * from
(SELECT payer , block_timestamp , row_number() over (partition by payer order by block_timestamp) as rn1
from flow.core.fact_transactions )
left join f
on rn = rn1+1 and p = payer )
where rn1 = 1)),
eth_users as
(SELECT count(*) as total, sum(in_a_week) as total_in_a_week
, sum(in_a_month) as total_in_a_month,
Run a query to Download Data