Tobi_1informal-aquamarine
Updated 2024-09-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
28
29
30
31
32
33
34
35
36
›
⌄
WITH token_transfers AS (
SELECT
BLOCK_TIMESTAMP::DATE AS transfer_date,
TO_ADDRESS AS holder_address,
FROM_ADDRESS,
AMOUNT
FROM
base.core.ez_token_transfers
WHERE
CONTRACT_ADDRESS = '0x532f27101965dd16442e59d40670faf5ebb142e4'
AND AMOUNT > 0 -- Ensure positive transfers
),
-- Step 1: Calculate holders since launch
holders_since_launch AS (
SELECT
transfer_date,
holder_address
FROM
token_transfers -- Use the CTE here instead of the base table
WHERE
transfer_date <= CURRENT_DATE
GROUP BY
transfer_date, holder_address
),
-- Step 2: Calculate holders in the last 30 days
holders_last_30_days AS (
SELECT
transfer_date,
holder_address
FROM
token_transfers -- Use the CTE here instead of the base table
WHERE
transfer_date BETWEEN DATEADD(DAY, -30, CURRENT_DATE) AND CURRENT_DATE
GROUP BY
QueryRunArchived: QueryRun has been archived