mondov2023-06-05 09:40 PM
Updated 2023-06-05
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
›
⌄
WITH withdraw_category AS (
SELECT
CASE
WHEN total_withdrawn < 10 THEN '< $10'
WHEN total_withdrawn >= 10 AND total_withdrawn < 100 THEN '$10-$100'
WHEN total_withdrawn >= 100 AND total_withdrawn < 1000 THEN '$100-$1,000'
WHEN total_withdrawn >= 1000 AND total_withdrawn < 10000 THEN '$1,000-$10,000'
WHEN total_withdrawn >= 10000 AND total_withdrawn < 100000 THEN '$10,000-$100,000'
ELSE '$100,000+'
END AS withdraw_category,
COUNT(DISTINCT DEPOSITOR_ADDRESS) AS num_withdrawers
FROM (
SELECT
DEPOSITOR_ADDRESS,
SUM(withdrawn_usd) AS total_withdrawn
FROM ethereum.aave.ez_withdraws
WHERE AAVE_MARKET = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
AND BLOCK_TIMESTAMP >= CURRENT_DATE - {{past_days}}
GROUP BY DEPOSITOR_ADDRESS
) AS subquery
GROUP BY withdraw_category
)
SELECT *
FROM withdraw_category
Run a query to Download Data