diff --git a/mention-counts.sql b/mention-counts.sql new file mode 100644 index 0000000..cc797ee --- /dev/null +++ b/mention-counts.sql @@ -0,0 +1,20 @@ +--- Displays which users have been mentioned the most +--- Invalid mentions are ignored + +SELECT + mentions.user_id, + users.name, + mentions.count AS mentions +FROM ( + SELECT + mentioned_id AS user_id, + COUNT(mentioned_id) + FROM mentions + WHERE guild_id = 181866934353133570 -- Programming + GROUP BY user_id +) AS mentions +JOIN users + ON users.user_id = mentions.user_id +GROUP BY mentions.user_id, mentions.count, users.name +ORDER BY mentions DESC; +