yasmin-n-d-r-h2023-07-31 09:01 PM
Updated 2023-07-31
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 MonthlyUserActivity AS (
SELECT
DATE_TRUNC('month', block_timestamp) AS month,
label_type ,
LABEL_SUBTYPE ,
PROJECT_NAME ,
COUNT(DISTINCT origin_from_address) AS active_users
FROM
aurora.core.fact_logs
JOIN
crosschain.core.address_labels ON address = contract_address
GROUP BY
1, 2, 3, 4
HAVING
month IS NOT NULL
)
SELECT
month,
label_type,
LABEL_SUBTYPE,
project_name ,
active_users AS total_active_users,
rank_by_active_users
FROM
(
SELECT
TO_CHAR(month, 'YYYY-MM') AS month,
label_type,
label_subtype ,
project_name,
active_users,
RANK() OVER(PARTITION BY label_type, label_subtype ,project_name ORDER BY active_users DESC) AS rank_by_active_users
FROM
MonthlyUserActivity
) AS ranked_data
Run a query to Download Data