Arkantransaction 6
Updated 2022-12-29
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
table1 as (
SELECT
tx_receiver,
sum(deposit / power(10, 24)) as in_volume
FROM
near.core.fact_transfers
WHERE block_timestamp::date >='2022-01-01'
GROUP BY 1
),
table2 as (
SELECT
TX_SIGNER,
sum(deposit / power(10, 24)) as out_volume
FROM
near.core.fact_transfers
WHERE block_timestamp::date >='2022-01-01'
GROUP BY 1
),
table3 as (
SELECT
*,
in_volume - out_volume as net_balance
FROM
table1 LEFT OUTER join table2 on tx_signer = tx_receiver
HAVING net_balance > 0
),
table4 as (
SELECT
tx_receiver as user1,
CASE
WHEN net_balance < 10 THEN 'Below 10 NEAR'
WHEN net_balance < 100 THEN 'Between 10 and 100 NEAR'
WHEN net_balance < 1000 THEN 'Between 100 and 1,000 NEAR'
WHEN net_balance < 10000 THEN 'Between 1,000 and 10,000 NEAR'
WHEN net_balance < 100000 THEN 'Between 10,000 and 100,000 NEAR'
Run a query to Download Data