/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


Report showing/listing all available categories count tickets per category per month current year

08/29/2018 482 views
Ttrying to create s report that will list all categories including null tickets count tickets for each category put 0 if no tickets for any of the categories for each month for current year.
Thank you in advance.
2 Comments   [ + ] Show comments

Comments

  • For one specific queue or for all queues?
  • There‚Äôs only one queue Chuck.

All Answers

1
Here you go:
SELECT HD_CATEGORY.NAME AS Category, 
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 1 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS January,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 2 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS February,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 3 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS March,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 4 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS April,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 5 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS May,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 6 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS June,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 7 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS July,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 8 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS August,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 9 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS September,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 10 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS October,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 11 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS November,
(SELECT COUNT(ID) FROM HD_TICKET where 
HD_CATEGORY_ID = HD_CATEGORY.ID 
and MONTH(HD_TICKET.CREATED) = 12 and YEAR(HD_TICKET.CREATED) = YEAR(NOW())) AS December

FROM HD_CATEGORY
ORDER BY HD_CATEGORY.NAME


Answered 08/29/2018 by: chucksteel
Red Belt

  • Thank you Chuck. Appreciate it.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ