What authors posted the most in a specific discord guild?
Query Name
guild_author_most_messages
SQL Query
select
guilds_t.guild_name,
authors_t.author_name,
author_msg_count.msg_count,
author_msg_count.guild_id,
authors_t.author_id as author_id,
author_msg_count.author_guild_id
from
(
select
guild_id,
author_guild_id,
count(content) as msg_count
from
messages_t
where
guild_id = ( select( id ) from guilds_t limit 1 )
group by
guild_id,
author_guild_id
) as author_msg_count
join guilds_t on author_msg_count.guild_id = guilds_t.id
join authors_t on author_msg_count.author_guild_id = authors_t.id
order by msg_count desc;