primo_datapolygon_nft_new_users
Updated 2022-07-15Copy 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
›
⌄
select tx.dt
, case when first_nft.from_address is not null then 'new_user_from_nft' else 'new_user_from_elsewhere' end new_user_type
, count(distinct tx.from_address) user_ct
from
(
-- First dates
select from_address, min(date(block_timestamp)) dt
from flipside_prod_db.polygon.transactions
where date(block_timestamp) >= date('2021-06-01')
and success = TRUE
group by 1
) tx
left join
(
-- First NFT transaction
Select nft.from_address, min(tx.dt) first_nft_dt
from
(
-- NFT Transaction
select date(block_timestamp) dt, tx_id
from flipside_prod_db.polygon.transactions
where date(block_timestamp) >= date('2021-06-01')
and to_label_type = 'nft'
and success = TRUE
) tx
inner join
(
-- NFT Transfer
select tx_id, from_address
from flipside_prod_db.polygon.udm_events
where date(block_timestamp) >= date('2021-06-01')
and from_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
and to_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
and amount_usd > 0
) nft
on tx.tx_id = nft.tx_id
Run a query to Download Data