Pine Analyticsreluctant-blush
Updated 2024-09-14
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 tab1 AS (
SELECT
block_timestamp,
to_address as user,
'in' as flow,
amount
FROM base.core.ez_token_transfers
WHERE contract_address LIKE lower('0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42')
union all
SELECT
block_timestamp,
from_address as user,
'out' as flow,
amount
FROM base.core.ez_token_transfers
WHERE contract_address LIKE lower('0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42')
), tab2 as (
SELECT
user,
min(date(block_timestamp)) as first_day,
max(date(block_timestamp)) as last_day,
sum(CASE when flow like 'in' then amount else -amount end) as balance
from tab1
GROUP BY 1
)
--SELECT *
--from tab2
SELECT
day,
QueryRunArchived: QueryRun has been archived