Skip to content

Commit

Permalink
Add mentions query.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ammon Smith committed Nov 30, 2017
1 parent 968903e commit 8a19c68
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mention-counts.sql
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 8a19c68

Please sign in to comment.