Query editor
WITH aethernet_fid AS (SELECT DISTINCTfidFROM dune.neynar.dataset_farcaster_fnamesWHEREfname = 'elefant'),mentions AS (SELECTc.fid,COUNT(*) AS mention_countFROM dune.neynar.dataset_farcaster_casts AS cWHEREdeleted_at IS NULLAND CONTAINS(c.mentions, (SELECT fid FROM aethernet_fid))AND c.fid != (SELECT fid FROM aethernet_fid) -- Exclude casts by `@aethernet`GROUP BY c.fid),mention_categories AS (SELECTfid,mention_count,CASEWHEN mention_count > 10 THEN 'High Frequency'WHEN mention_count BETWEEN 2 AND 10 THEN 'Medium Frequency'ELSE 'Low Frequency'END AS frequency_categoryFROM mentions)-- Final selection including total mentions by category and overall total mentionsSELECTfrequency_category,COUNT(*) AS user_count,SUM(mention_count) AS total_mentions,(SELECT SUM(mention_count) FROM mentions) AS overall_total_mentions -- Total mentions across all categoriesFROM mention_categoriesGROUP BY frequency_categoryORDER BY frequency_category;