grahamSingle Buyer vs Multiple
Updated 2023-11-16
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
with b0 as (
select
distinct
purchaser,
COALESCE(INITCAP(REPLACE(l.label, '_', ' ')), 'Other') AS collection,
count(mint) as purchases
FROM solana.nft.fact_nft_sales s
LEFT JOIN solana.core.dim_labels l
ON l.address = s.mint
WHERE s.block_timestamp >= CASE WHEN '{{start_date}}' = '' THEN '2021-01-01' ELSE '{{start_date}}' END
AND s.block_timestamp <= CASE WHEN '{{end_date}}' = '' THEN CURRENT_DATE ELSE '{{end_date}}' END
AND s.succeeded
and collection ilike case when '{{collection_search}}' = '' then '{{collection}}' else '{{collection_search}}' end
group by 1,2
)
SELECT
case when purchases > 1 then 'Multiple Purchases' else 'Single Purchaser' end as purchase_type,
count(distinct purchaser) as num_purchasers
from b0
group by 1
Run a query to Download Data