Query editor
WITHResolveFnameToFid AS (SELECTfidFROMdune.neynar.dataset_farcaster_profile_with_addressesWHERELOWER(fname) = LOWER('{{user_input_fname}}')LIMIT1),MyCasts AS (SELECTc.hash,c.parent_hash,c.root_parent_url,c.timestamp,CASEWHEN c.root_parent_url IS NOT NULL THENCASEWHEN c.root_parent_url LIKE 'https://warpcast.com/~/channel/%' THEN SUBSTRING(c.root_parent_url, LENGTH('https://warpcast.com/~/channel/') + 1)WHEN c.root_parent_url LIKE 'https://farcaster.group/%' THEN SUBSTRING(c.root_parent_url, LENGTH('https://farcaster.group/') + 1)WHEN c.root_parent_url LIKE 'chain://eip155%' THEN 'unknown'ELSE c.root_parent_urlENDWHEN c.parent_hash IS NOT NULL THENCASEWHEN p.root_parent_url LIKE 'https://warpcast.com/~/channel/%' THEN SUBSTRING(p.root_parent_url, LENGTH('https://warpcast.com/~/channel/') + 1)WHEN p.root_parent_url LIKE 'https://farcaster.group/%' THEN SUBSTRING(p.root_parent_url, LENGTH('https://farcaster.group/') + 1)WHEN p.root_parent_url LIKE 'chain://eip155%' THEN 'unknown'ELSE COALESCE(p.root_parent_url, 'no_channel')ENDELSE 'no_channel'END AS channelFROM dune.neynar.dataset_farcaster_casts cLEFT JOIN dune.neynar.dataset_farcaster_casts p ON c.parent_hash = p.hashWHEREc.fid = (SELECT fid FROM ResolveFnameToFid)),MyStats AS (SELECTmc.channel,COUNT(*) as casts_countFROMMyCasts mcWHEREchannel NOT IN ('unknown', 'no_channel')GROUP BY channel)SELECT x.*FROM MyStats xORDER BY x.casts_count DESC-- FROM MyCasts-- WHERE-- parent_ = 'no_channel'-- ORDER BY-- timestamp DESC