Report to see total number of tickets for the year and sort by priority
Hello Im trying to see how I would create a report to get the total number of tickets for the year and sort by priority. It would be nice to be able to get them for a specific queue as well I am not very SQL savy and the wizard hasnt been much help.
Answers (1)
When you say "the total number of tickets for the year" Do you mean the total number of tickets logged in the year or the total number of tickets resolved in a year?
I produced this SQL by using the reporting wizard
SELECT
HD_TICKET.ID,
IF(HD_TICKET.HD_USE_PROCESS_STATUS and HD_TICKET.IS_PARENT, HD_SERVICE_STATUS.NAME, HD_STATUS.NAME) AS STATUS_NAME,
HD_TICKET.CREATED,
HD_TICKET.TIME_CLOSED
FROM HD_TICKET
LEFT JOIN HD_SERVICE_STATUS ON HD_TICKET.HD_USE_PROCESS_STATUS and HD_TICKET.HD_SERVICE_STATUS_ID and HD_SERVICE_STATUS.ID = HD_TICKET.HD_SERVICE_STATUS_ID
LEFT JOIN HD_STATUS ON (HD_STATUS.ID = HD_TICKET.HD_STATUS_ID)
WHERE
(HD_TICKET.HD_QUEUE_ID = 1) AND
(((TIMESTAMP(HD_TICKET.CREATED) <= NOW() AND TIMESTAMP(HD_TICKET.CREATED) > DATE_SUB(NOW(),INTERVAL 1 YEAR))))
ORDER BY ID, STATUS_NAME
If you were to remove the first line of the WHERE statement, it would give you all Queues