freemartianUntitled Query
Updated 2022-08-18
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
›
⌄
with inbound as (
select
date_trunc('month', block_timestamp::date) as period,
sum(amount) as total_amount,
token_contract
from flow.core.fact_bridge_transactions
where direction = 'inbound'
group by token_contract, period
),
outbound as (
select
date_trunc('month', block_timestamp::date) as period,
sum(amount) as total_amount,
token_contract
from flow.core.fact_bridge_transactions
where direction = 'outbound'
group by token_contract, period
)
select
i.period,
i.token_contract,
o.token_contract,
i.total_amount as inflow,
o.total_amount as outflow
from inbound i
left join outbound o on (i.period = o.period and i.token_contract = o.token_contract)
Run a query to Download Data