What discord attachment message has the most reactions?
SUPER INEFFICIENT
Query Name
guild_attachment_reactions
SQL Query
select
guilds_t.guild_name,
channels_t.channel_name,
authors_t.author_name,
authors_t.nickname,
messages_t.msg_content,
messages_t.msg_timestamp,
guilds_t.id,
channels_t.id,
authors_t.id,
authors_t.author_id
from
(
select
attachment_messages_t.id as message_id,
sum(reaction_count) as reaciton_count
from
(
select
*
from
messages_t
where
attachments = 'True'
-- and guild_id = '{}'
) as attachment_messages_t
join reactions_t on reactions_t.message_id = attachment_messages_t.id
group by attachment_messages_t.id
) as attachment_reaction_sum_t
join messages_t on attachment_reaction_sum_t.message_id = messages_t.id
join authors_t on messages_t.author_guild_id = authors_t.id
join channels_t on messages_t.channel_id = channels_t.id
join guilds_t on messages_t.guild_id = guilds_t.id
order by reaciton_count desc;