-- forked from dsaber / Monthly unique programs @ https://flipsidecrypto.xyz/dsaber/q/ayx2g5ZEjr4h/monthly-unique-programs
SELECT
concat(year(to_timestamp(block_timestamp)),'-Q',quarter(to_timestamp(block_timestamp))) as quarter
,COUNT(DISTINCT program_id) AS num_programs
FROM solana.core.fact_events
WHERE succeeded
AND block_timestamp::DATE >= '2022-04-01'
AND block_timestamp::DATE <= '2023-09-30'
GROUP BY 1
ORDER BY 1 DESC