What authors posted the most in each discord guild?
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;
Similar Queries
Backlinks