/build/static/layout/Breadcrumb_cap_w.png

Custom Report Help

I would like to create a helpdesk report that shows the amount work work logged on a ticket.  I have created the following via the wizard, but it doesn't show me the work logged on the ticket only the notes.

SELECT HD_TICKET.ID, HD_TICKET.TITLE, O.FULL_NAME AS OWNER_NAME, HD_TICKET.CUSTOM_FIELD_VALUE0, HD_WORK.NOTE  FROM HD_TICKET  LEFT JOIN USER O ON (O.ID = HD_TICKET.OWNER_ID) LEFT JOIN HD_WORK ON (HD_WORK.HD_TICKET_ID = HD_TICKET.ID) WHERE (HD_TICKET.HD_QUEUE_ID = 2) AND (((TIMESTAMP(HD_TICKET.CREATED) <= NOW() AND TIMESTAMP(HD_TICKET.CREATED) > DATE_SUB(NOW(),INTERVAL 60 DAY))) AND (HD_WORK.NOTE is not null))  ORDER BY CUSTOM_FIELD_VALUE0, ID

We enter the amount of time we spend on a ticket, and are wanting to see what we are spending our time doing.


0 Comments   [ + ] Show comments

Answers (1)

Posted by: IgorAngelini 2 years ago
Second Degree Blue Belt
0

Maybe this will help:

SELECT HD_TICKET.ID,
       HD_TICKET.TITLE,
       O.FULL_NAME AS OWNER_NAME,
       HD_TICKET.CUSTOM_FIELD_VALUE0,
       TIMESTAMPDIFF(HOUR /*MINUTE*/ /*DAY*/, HD_WORK.START, HD_WORK.STOP) AS "HOURS TAKEN",
       HD_WORK.ADJUSTMENT_HOURS,
       HD_WORK.NOTE  

FROM HD_TICKET  

LEFT JOIN USER O
     ON O.ID = HD_TICKET.OWNER_ID
LEFT JOIN HD_WORK
     ON HD_WORK.HD_TICKET_ID = HD_TICKET.ID
     
WHERE HD_TICKET.HD_QUEUE_ID = 2

AND TIMESTAMP(HD_TICKET.CREATED) <= NOW()
AND TIMESTAMP(HD_TICKET.CREATED) > DATE_SUB(NOW(), INTERVAL 60 DAY)
AND HD_WORK.NOTE is not null

ORDER BY CUSTOM_FIELD_VALUE0, ID


Note on TIMESTAMPDIFF that you can change how the value is returned, right now it's returning hours, but can be minutes or days https://mariadb.com/kb/en/timestampdiff/

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