WITH total AS(
(SELECT
PROGRAM_ID,
COUNT(DISTINCT tx_id) as tx_count
FROM solana.core.fact_events
WHERE SUCCEEDED = 'FALSE'
and block_timestamp::date BETWEEN '2022-01-01' and '2022-02-01'
GROUP BY 1
)
UNION ALL
(SELECT
PROGRAM_ID,
COUNT(DISTINCT tx_id) as tx_count
FROM solana.core.fact_events
WHERE SUCCEEDED = 'FALSE'
and block_timestamp::date BETWEEN '2022-02-01' and '2022-03-01'
GROUP BY 1
)
UNION ALL
(SELECT
PROGRAM_ID,
COUNT(DISTINCT tx_id) as tx_count
FROM solana.core.fact_events
WHERE SUCCEEDED = 'FALSE'
and block_timestamp::date BETWEEN '2022-03-01' and '2022-04-01'
GROUP BY 1
)
UNION ALL
(SELECT
PROGRAM_ID,
COUNT(DISTINCT tx_id) as tx_count
FROM solana.core.fact_events
WHERE SUCCEEDED = 'FALSE'
and block_timestamp::date BETWEEN '2022-04-01' and '2022-05-01'
GROUP BY 1
)