Skip to content

What discord user was the most active for a particular date range within a particular discord guild?

Query Name

SQL Query


select
    authors_t.author_name,
    authors_t.nickname,
    msg_count_per_author_t.msg_count,
    msg_count_per_author_t.author_guild_id,
    guilds_t.guild_name,
    guilds_t.id as guild_id
from
(
    select
        count(content) as msg_count,
        author_guild_id
    from
        messages_t
    where
        msg_timestamp > to_date('2023-10-01', 'YYYY-MM-DD')
        and msg_timestamp < to_date('2023-10-12', 'YYYY-MM-DD') 
    group by author_guild_id
    order by msg_count desc
) as msg_count_per_author_t
join authors_t on msg_count_per_author_t.author_guild_id = authors_t.id
join guilds_t  on authors_t.guild_id = guilds_t.id
order by msg_count_per_author_t.msg_count desc;

Similar Queries