What is the age of the oldest message in each channel of a specific discord guild?
Query Name
guild_oldest_message
SQL Query
select
guilds_t.guild_name,
channels_t.channel_name,
authors_t.author_name,
authors_t.nickname,
earliest_message_t.msg_content,
earliest_message_t.msg_timestamp,
guilds_t.id,
channels_t.id,
authors_t.id,
authors_t.author_id,
authors_t.is_bot
from
(
select
*
from
messages_t
where
guild_id = (select id from guilds_t limit 1)
order by msg_timestamp asc
limit 1
) as earliest_message_t
join authors_t on earliest_message_t.author_guild_id = authors_t.id
join channels_t on earliest_message_t.channel_id = channels_t.id
join guilds_t on earliest_message_t.guild_id = guilds_t.id
limit 1;