SajjadiiiFlow ALLDAY 1 Purchase frequency non t
Updated 2022-12-04Copy 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
›
⌄
WITH allday AS (
SELECT block_timestamp ,
buyer
FROM flow.core.ez_nft_sales
WHERE nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
AND tx_succeeded = 'TRUE'
AND block_timestamp::date >= '2022-11-24' -- since Thanksgiving to now
),
non_Purchase_allday AS (
SELECT a.buyer,
COUNT(DISTINCT tx_id) AS buy_count
FROM flow.core.ez_nft_sales a
LEFT JOIN allday b
ON a.buyer = b.buyer
WHERE a.buyer IN (SELECT buyer FROM allday )
AND tx_succeeded = 'TRUE'
AND nft_collection != 'A.e4cf4bdc1751c65d.AllDay'
GROUP BY 1
)
SELECT CASE WHEN buy_count = 1 THEN 'Purchase One time'
WHEN buy_count between 1 and 10 THEN 'Purchase 1~10 time '
WHEN buy_count between 10 and 100 THEN 'Purchase 10~100 time '
WHEN buy_count between 100 and 200 THEN 'Purchase 100~200 time '
WHEN buy_count between 200 and 500 THEN 'Purchase 200~500 time '
ELSE 'More Then 500 time' END AS Purchase_frequency,
COUNT(DISTINCT buyer ) AS buyers
FROM non_Purchase_allday
GROUP BY 1
Run a query to Download Data