Skip to content

What discord channel has the longest average message length?

Query Name

guild_channel_longest_msg_content

SQL Query


select 
    guilds_t.guild_name,
    channels_t.channel_name,
    channels_t.channel_type,
    avg_content_length_t.content_length,
    avg_content_length_t.content_count,
    guilds_t.id as guild_id,
    channels_t.id as channel_id
from 
(
    select 
        channel_id, 
        count(content_length) as content_count,
        AVG(content_length) as content_length
    from
        messages_t
    where
        is_bot = false
        -- and guild_id = '{}'
    group by channel_id
) as avg_content_length_t
join channels_t on channels_t.id = avg_content_length_t.channel_id
join guilds_t   on channels_t.guild_id = guilds_t.id
order by avg_content_length_t.content_length desc;

Similar Queries