Created
May 17, 2013 14:10
-
-
Save ctaloi/5599268 to your computer and use it in GitHub Desktop.
OTRS Query
This file contains hidden or 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
/* Today */ | |
select q.name AS queue_name, COUNT(*) AS Tickets | |
FROM queue AS q, ticket AS t, article AS a, article_type AS a_t, ( | |
SELECT _a.ticket_id, MAX(_a.create_time) AS create_time | |
FROM ticket AS _t, ticket_state AS _t_s, article AS _a | |
WHERE _t_s.name IN ('new', 'open', 'Vendor Assigned', 'Research, Escalated') | |
AND _t.ticket_state_id = _t_s.id | |
AND _a.ticket_id = _t.id | |
GROUP BY _a.ticket_id | |
) a_max | |
WHERE q.id = t.queue_id | |
AND t.id = a_max.ticket_id | |
AND a.create_time = a_max.create_time | |
AND a_t.id = a.article_type_id | |
GROUP BY q.name | |
ORDER BY Tickets DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, thanks for sharing this querie, it is a good example for my future queries.
You could share more queries?