Query editor
--top influencers with most followers per dayWITH daily_followers AS (SELECTDATE(timestamp) AS day,target_fid,COUNT(DISTINCT fid) AS followers_count /* Count unique followers */FROM dune.neynar.dataset_farcaster_linksWHEREtype = 'follow' /* Focus on 'follow' actions */AND timestamp >= CAST('2024-01-01' AS TIMESTAMP)AND timestamp < CAST('2024-04-01' AS TIMESTAMP)GROUP BY1,target_fid), ranked_influencers AS (SELECTday,target_fid,followers_count,RANK() OVER (PARTITION BY day ORDER BY followers_count DESC) AS rank /* Rank influencers */FROM daily_followers)SELECTr.day,r.target_fid,(SELECThashFROM dune.neynar.dataset_farcaster_linksWHEREtarget_fid = r.target_fidORDER BYtimestamp DESCLIMIT 1) AS hash,'follow' AS type, /* Since we're only considering 'follow' actions */r.followers_countFROM ranked_influencers AS rWHEREr.rank = 1 /* Select top influencers for each day */ORDER BYr.day