Mrfti2023-04-23 12:51 AM
Updated 2023-05-22
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
›
⌄
WITH tbl AS (
SELECT tx_from AS address
--, SUM(-amount) AS net_amount
FROM solana.core.fact_transfers
WHERE mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
--GROUP BY 1
UNION
SELECT tx_to AS address
--, SUM(amount) AS net_amount
FROM solana.core.fact_transfers
WHERE mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
--GROUP BY 1
), tbl2 AS (
SELECT address
--, SUM(net_amount) AS net_amount
FROM tbl
--GROUP BY 1
), tbl3 AS (
SELECT address
--, net_amount
FROM tbl2
--WHERE net_amount >= 1
)
SELECT
COUNT( DISTINCT address) AS n_unique_holders
--, MEDIAN(net_amount) AS median_amount_held
FROM tbl3
Run a query to Download Data