Skip to content

How many attachments of a separate file types are in a discord guild?

Query Name

guild_attachment_file_type_count

SQL Query


select
    guilds_t.guild_name,
    attachment_extension_count_t.file_extension,
    attachment_extension_count_t.extension_count,
    guild_id 
from
(
    select
        guild_id,
        file_extension,
        count(file_extension) as extension_count
    from
        attachments_t
    group by guild_id, file_extension
) as attachment_extension_count_t
join guilds_t on attachment_extension_count_t.guild_id = guilds_t.id
order by extension_count desc;