Soheil_MKUntitled Query
Updated 2023-02-14Copy 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 withdraw as (
select
BLOCK_TIMESTAMP::date as date,
TX_SIGNER as wallet,
sum((DEPOSIT/pow(10,24))) as near_amounts
from near.core.fact_transfers
where STATUS='TRUE'
and DEPOSIT is not null
group by 1,2
),
deposit as (
select
BLOCK_TIMESTAMP::date as date,
TX_RECEIVER as wallet,
sum((DEPOSIT/pow(10,24))) as near_amounts
from near.core.fact_transfers
where STATUS='TRUE'
and DEPOSIT is not null
group by 1,2
),
user_balance as (
select
date ,
wallet ,
sum (zeroifnull(a.near_amounts) - zeroifnull(b.near_amounts)) balance
from deposit a
full outer join withdraw b
using(wallet,date)
group by 1,2
having balance > 0
),
Run a query to Download Data