nitsTOP N Balance Holders
Updated 2022-12-15Copy 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
›
⌄
with sender as
(select
sum(AMOUNT) as send, SENDER
from terra.core.ez_transfers
where
CURRENCY='uluna'
group by 2),
RECEIVER
as
(
select
sum(AMOUNT) as receive, RECEIVER
from terra.core.ez_transfers
where
CURRENCY='uluna'
group by 2
)
select
case when receive is null then 0 else receive end as receivee, RECEIVER as user , (receivee-send)/1e6 as balance
from sender a left join RECEIVER b
on a.sender=b.RECEIVER
order by balance desc
limit {{n}}
Run a query to Download Data