SniperUntitled Query
Updated 2022-10-10Copy 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
›
⌄
WITH tab1 as (
SELECT
-- date_trunc('week', block_timestamp) as week,
label,
count(DISTINCT tx_id) as events,
count(DISTINCT INSTRUCTION:accounts[1]) as users
FROM solana.core.fact_events
LEFT outer JOIN solana.core.dim_labels
on program_id = address
WHERE label_type IN ('dex', 'defi')
AND block_timestamp > '2022-09-01'
GROUP BY 1--, 2
ORDER by 2 DESC
LIMIT 15
--ORDER by 2 DESC
--LIMIT 10
)
SELECT
date_trunc('day', block_timestamp) as day,
label,
count(DISTINCT tx_id) as events,
count(DISTINCT INSTRUCTION:accounts[1]) as users
FROM solana.core.fact_events
LEFT outer JOIN solana.core.dim_labels
on program_id = address
WHERE label_type IN ('dex', 'defi')
AND block_timestamp > '2022-09-01'
AND label in (SELECT label from tab1)
GROUP BY 1, 2
Run a query to Download Data