Afonso_DiazGrouping balances
Updated 2024-04-15
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
deposit as (
select user,sum(increase_volume) as increase_volume from (
select
to_address as user,
sum(amount) as increase_volume
from blast.core.ez_native_transfers
where tx_hash not in (select distinct tx_hash from blast.core.ez_native_transfers where to_address = origin_from_address)
group by 1
union
select
to_address as user,
sum(amount) as increase_volume
from blast.core.ez_native_transfers
where to_address = origin_from_address
group by 1
)
group by 1
),
withdraw as (
select
from_address as user,
sum(amount) as decrease_volume
from blast.core.ez_native_transfers
where from_address = origin_from_address
group by 1
),
balances as (
select
user,
increase_volume - nvl(decrease_volume, 0) - nvl((select sum(tx_fee) from blast.core.fact_transactions where from_address = user), 0) as balance_eth
QueryRunArchived: QueryRun has been archived