Skip to content

What discord channel has the longest average message length of a specific guild?

Query Name

guild_channel_message_length

SQL Query


select
    guild_name,
    channel_name,
    msg_length,
    msg_count,
    channel_id
from
(
    select
        channel_id,
        avg(msg_content_length) as msg_length,
        count(msg_content_length) as msg_count
    from
        messages_t
    where
        guild_id in (  (select id from guilds_t limit 1)  )
        and messages_t.is_bot = 'F'
    group by channel_id
) as author_in_channel_count_t
join channels_t on author_in_channel_count_t.channel_id = channels_t.id
join guilds_t on channels_t.guild_id = guilds_t.id
order by msg_length desc;

Similar Queries