Query editor
WITH buyer_collections AS (SELECTbuyer_address,LISTAGG(DISTINCT name, ', ') WITHIN GROUP (ORDER BY name) as collections_boughtFROM ethereum.nft.ez_nft_salesWHEREblock_timestamp >= CURRENT_DATE - INTERVAL '7 days'AND event_type = 'sale'AND price_usd IS NOT NULLGROUP BY buyer_address)SELECTs.buyer_address as buyer,COUNT(*) AS number_of_trades,SUM(price_usd) AS total_spent_usd,AVG(price_usd) AS avg_purchase_usd,SUM(CAST(quantity AS INTEGER)) AS total_items_bought,COUNT(DISTINCT contract_address) AS unique_collections_bought,MIN(block_date::DATE) AS first_purchase_date,MAX(block_date::DATE) AS last_purchase_date,bc.collections_boughtFROMnft.trades sLEFT JOIN buyer_collections bc ON s.buyer_address = bc.buyer_addressWHEREblock_timestamp >= CURRENT_DATE - INTERVAL '7' dayAND event_type = 'sale'AND price_usd IS NOT NULLGROUP BYs.buyer_address,bc.collections_boughtORDER BYtotal_spent_usd DESCLIMIT 50;