Skip to content

What author posted the most in a specific discord guild?

SQL Query


select
    guild_name,
    author_name,
    nickname,
    msg_count,
    guild_id,
    author_id,
    author_guild_id
from 
(
    select
        count(*) as msg_count,
        author_guild_id
    from
        messages_t
    where
        guild_id = (select id from guilds_t limit 1)
    group by author_guild_id
) as agg_t
join authors_t on agg_t.author_guild_id = authors_t.id
join guilds_t  on authors_t.guild_id = guilds_t.id
order by msg_count desc

Similar Queries