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 transactionsCOUNT(CASE WHEN block_date > CURRENT_DATE - INTERVAL '1' month THEN 1 END) AS last_month_count -- Count transactions in the last monthFROM zora.transactions -- Source table for Zora transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)UNION 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 transactionsCOUNT(CASE WHEN block_date > CURRENT_DATE - INTERVAL '1' month THEN 1 END) AS last_month_count -- Count transactions in the last monthFROM mode.transactions -- Source table for Mode transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)UNION 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 transactionsCOUNT(CASE WHEN block_date > CURRENT_DATE - INTERVAL '1' month THEN 1 END) AS last_month_count -- Count transactions in the last monthFROM optimism.transactions -- Source table for Optimism transactionsWHERE"from" IN (SELECTrecipient -- Filter where the sender is in the list of recipientsFROM recipients)UNION ALL -- Combine results with the next query-- Aggregating transaction data from the Arbitrum networkSELECT'arbitrum' AS network, -- Label the network as 'arbitrum'COUNT(*) AS transaction_count, -- Count all transactionsCOUNT(CASE WHEN block_date > CURRENT_DATE - INTERVAL '1' month THEN 1 END) AS last_month_count -- Count transactions in the last monthFROM arbitrum.transactions -- Source table for Arbitrum transactions