Query editor
-- Define a temporary table "recipients" containing addresses from the dataset_current_badgeholders_2024 tableWITH recipients AS (SELECTaddress as recipient -- Select the address column and alias it as recipientFROM dune.lamora.dataset_current_badgeholders_2024 -- Source table),-- Define another temporary table "counts" to aggregate transaction data from multiple networkscounts AS (-- Aggregating transaction data from the Zora networkSELECT'zora' AS network, -- Label the network as 'zora'COUNT(*) AS transaction_count, -- Count all transactionsDATE_TRUNC('month', block_time) AS month -- Truncate the block time to the monthFROM zora.transactions -- Source table for Zora transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)AND block_time >= DATE_TRUNC('year', CURRENT_DATE) - INTERVAL '1' YEAR -- Only consider transactions from the past yearGROUP BY3 -- Group by the truncated monthUNION ALL -- Combine results with the next query-- Aggregating transaction data from the Mode networkSELECT'mode' AS network, -- Label the network as 'mode'COUNT(*) AS transaction_count, -- Count all transactionsDATE_TRUNC('month', block_time) AS month -- Truncate the block time to the monthFROM mode.transactions -- Source table for Mode transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)AND block_time >= DATE_TRUNC('year', CURRENT_DATE) - INTERVAL '1' YEAR -- Only consider transactions from the past yearGROUP BY3 -- Group by the truncated monthUNION ALL -- Combine results with the next query-- Aggregating transaction data from the Optimism networkSELECT'optimism' AS network, -- Label the network as 'optimism'COUNT(*) AS transaction_count, -- Count all transactionsDATE_TRUNC('month', block_time) AS month -- Truncate the block time to the monthFROM optimism.transactions -- Source table for Optimism transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)AND block_time >= DATE_TRUNC('year', CURRENT_DATE) - INTERVAL '1' YEAR -- Only consider transactions from the past yearGROUP BY3 -- Group by the truncated month