-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ammon Smith
committed
Nov 30, 2017
1 parent
968903e
commit 8a19c68
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|