behnamqDestination that are in both the top 50 count and top 50 sum amount lists based
Updated 2022-07-27Copy 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
›
⌄
WITH tx_sol as (
SELECT BLOCK_TIMESTAMP, tx_id, INSTRUCTION:parsed:info:authority as authority, INSTRUCTION:parsed:info:source as source,
INSTRUCTION:parsed:info:destination as destination, INSTRUCTION:parsed:info:amount as amount
From solana.core.fact_events
Where SUCCEEDED = TRUE and index = 2 and event_type = 'transfer' and PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
)
, top_50_source as (
SELECT top 50 source, COUNT(*) as count_tx, sum(amount) as total_amount from tx_sol
GROUP by 1
order by 2 desc
)
, top_50_destination as (
SELECT top 50 destination, COUNT(*) as count_tx, sum(amount) as total_amount from tx_sol
GROUP by 1
order by 2 desc
)
, top_50_source_amount as (
SELECT top 50 source, COUNT(*) as count_tx, sum(amount) as total_amount from tx_sol
GROUP by 1
order by 3 desc
)
, top_50_destination_amount as (
SELECT top 50 destination, COUNT(*) as count_tx, sum(amount) as total_amount from tx_sol
GROUP by 1
order by 3 desc
)
SELECT * --top 50 destination, COUNT(*) as count_tx, sum(amount) as total_amount
from top_50_destination as tpd join top_50_destination_amount as tpda
on tpd.destination=tpda.destination
--GROUP by 1
Run a query to Download Data