/build/static/layout/Breadcrumb_cap_w.png

Monthly HD Report

Hello,

I have looked over the thread here: http://itninja.com/question/possible-corrupt-packages0&mpage=1&key=queue𑊙
and it does most of what i'm looking to do except we use departments and need the tickets broken down by department (we have it mapped to Custom 1)

i Like this SQL select Gerald put in the above thread but instead of owner, i'd like to see if we could get sorted by department (Custom 1)
SELECT OPEN.OWNER,
OPEN.MONTH,
OPEN.YEAR,
Coalesce(OPEN.OPEN, 0) AS OPENED,
Coalesce(CLOSED.CLOSED, 0) AS CLOSED
FROM (SELECT Coalesce(U.USER_NAME, 'NO OWNER ASSIGNED') AS OWNER,
MONTH(T.CREATED) AS MONTH,
YEAR (T.CREATED) AS YEAR,
COUNT(*) AS OPEN ,
T.HD_QUEUE_ID
FROM HD_TICKET T
LEFT JOIN USER U
ON T.OWNER_ID = U.ID
GROUP BY OWNER_ID,
MONTH,
YEAR
ORDER BY YEAR,
MONTH) OPEN
LEFT JOIN (SELECT Coalesce(U.USER_NAME, 'NO OWNER ASSIGNED') AS OWNER,
MONTH(T.TIME_CLOSED) AS MONTH,
YEAR (T.TIME_CLOSED) AS YEAR,
COUNT(*) AS CLOSED ,
T.HD_QUEUE_ID
FROM HD_TICKET T
JOIN HD_STATUS S ON HD_STATUS_ID=S.ID and S.STATE ='Closed'
LEFT JOIN USER U
ON T.OWNER_ID = U.ID
GROUP BY OWNER_ID,
MONTH,
YEAR
ORDER BY YEAR,
MONTH) CLOSED
ON( OPEN.MONTH = CLOSED.MONTH
AND OPEN.YEAR = CLOSED.YEAR
AND OPEN.OWNER = CLOSED.OWNER )
WHERE (OPEN.HD_QUEUE_ID IS NULL OR OPEN.HD_QUEUE_ID IN (1,0)) /*change queue numbers here*/
and (CLOSED.HD_QUEUE_ID IS NULL OR CLOSED.HD_QUEUE_ID IN (1,0)) /*change queue numbers here*/
ORDER BY 3,2,1

0 Comments   [ + ] Show comments

Answers (0)

Be the first to answer this question

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

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

Sign up! or login

View more:

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