Tobi_1boring-chocolate
Updated 2024-08-03
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
›
⌄
⌄
WITH Daily_Transactions AS (
SELECT
DATE_TRUNC('DAY', BLOCK_TIMESTAMP) AS transaction_day,
STATUS,
COUNT(*) AS transaction_count
FROM
base.core.fact_transactions;
WHERE
BLOCK_TIMESTAMP >= DATEADD(DAY, -30, CURRENT_TIMESTAMP())
AND BLOCK_TIMESTAMP < CURRENT_TIMESTAMP()
GROUP BY
transaction_day,
STATUS
),
Daily_Successful_Transactions AS (
SELECT
transaction_day,
transaction_count AS successful_transactions
FROM
Daily_Transactions
WHERE
STATUS = 'SUCCESS'
)
SELECT
transaction_day,
COALESCE(successful_transactions, 0) AS successful_transactions
FROM
Daily_Successful_Transactions
ORDER BY
transaction_day;
QueryRunArchived: QueryRun has been archived