What discord author edits the highest percentage of their messages within a particular discord guild?
Query Name
guild_author_edit_percentage
SQL Query
Note: the min message count has already been added
select
authors_t.author_name,
authors_t.nickname,
msg_timestamp_edited_count_t.msg_timestamp_edited_count,
author_msg_count_t.msg_count,
msg_timestamp_edited_count_t.msg_timestamp_edited_count::FLOAT / author_msg_count_t.msg_count::FLOAT * 100 as msg_edited_percentage,
msg_timestamp_edited_count_t.author_guild_id,
guilds_t.guild_name,
guilds_t.id as guild_id
from
(
select
count(*) as msg_timestamp_edited_count,
author_guild_id
from
messages_t
where
msg_timestamp_edited is not null
and guild_id in ( (select id from guilds_t limit 1) )
group by author_guild_id
) as msg_timestamp_edited_count_t
join (
select
count(*) as msg_count,
author_guild_id
from
messages_t
where guild_id in ( (select id from guilds_t limit 1) )
group by author_guild_id
) as author_msg_count_t on author_msg_count_t.author_guild_id = msg_timestamp_edited_count_t.author_guild_id
join authors_t on msg_timestamp_edited_count_t.author_guild_id = authors_t.id
join guilds_t on authors_t.guild_id = guilds_t.id
where msg_count > 1
order by msg_edited_percentage desc;