total number of tickets submitted by user/submitter
I would greatly appreciate it if you can help me with an SQL report that can list all submitters in order of the highest to lowest number of tickets submitted.
Thank you in advance.
1 Comment
[ + ] Show comment
-
Thank you five. I’ll give it a go. - aoh 6 years ago
Answers (1)
Please log in to answer
Posted by:
five.
6 years ago
I believe this old answer would suffice.
Just comment out the where date line and it'll show them all and add an order by at the end, like so:
Just comment out the where date line and it'll show them all and add an order by at the end, like so:
SELECT U.FULL_NAME AS 'Full Name', U.USER_NAME AS 'Username', COUNT(*) AS 'Number of Tickets'
FROM HD_TICKET T LEFT JOIN USER U ON T.SUBMITTER_ID = U.ID
/* WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= T.CREATED */
GROUP BY U.USER_NAME
ORDER BY COUNT(*) DESC