Add Due Date Column to an existing report
I am trying to add the "Due Date" column to an existing report but cannot figure out the coding. Can you please point me in the right direction? I am using the following codes for my report:
-------------------------------------------------------------------------------------------------------------
SELECT HD_TICKET.ID,
HD_TICKET.TITLE,
HD_CATEGORY.NAME AS CATEGORY,
HD_TICKET.TIME_OPENED,
HD_TICKET.TIME_CLOSED,
HD_TICKET.DUE_DATE,
O.FULL_NAME AS OWNER_NAME,
S.FULL_NAME AS SUBMITTER_NAME,
HD_STATUS.NAME AS STATUS,
HD_PRIORITY.NAME AS PRIORITY,
HD_TICKET.CUSTOM_FIELD_VALUE2
FROM HD_TICKET
JOIN HD_CATEGORY ON (HD_CATEGORY.ID = HD_TICKET.HD_CATEGORY_ID)
LEFT JOIN USER O ON (O.ID = HD_TICKET.OWNER_ID)
LEFT JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
JOIN HD_STATUS ON (HD_STATUS.ID = HD_TICKET.HD_STATUS_ID)
JOIN HD_DUE_DATE ON (HD_STATUS.ID = HD_TICKET.DUE_DATE_ID)
JOIN HD_PRIORITY ON (HD_PRIORITY.ID = HD_TICKET.HD_PRIORITY_ID)
WHERE (HD_TICKET.HD_QUEUE_ID != 5) AND ((TIMESTAMP(HD_TICKET.TIME_CLOSED) <= NOW() AND TIMESTAMP(HD_TICKET.TIME_CLOSED) > DATE_SUB(NOW(),INTERVAL 30 DAY))) AND (HD_STATUS.NAME = 'Closed') ORDER BY CATEGORY
-------------------------------------------------------------------------------------------------------------
Thanks in advance!
-------------------------------------------------------------------------------------------------------------
SELECT HD_TICKET.ID,
HD_TICKET.TITLE,
HD_CATEGORY.NAME AS CATEGORY,
HD_TICKET.TIME_OPENED,
HD_TICKET.TIME_CLOSED,
HD_TICKET.DUE_DATE,
O.FULL_NAME AS OWNER_NAME,
S.FULL_NAME AS SUBMITTER_NAME,
HD_STATUS.NAME AS STATUS,
HD_PRIORITY.NAME AS PRIORITY,
HD_TICKET.CUSTOM_FIELD_VALUE2
FROM HD_TICKET
JOIN HD_CATEGORY ON (HD_CATEGORY.ID = HD_TICKET.HD_CATEGORY_ID)
LEFT JOIN USER O ON (O.ID = HD_TICKET.OWNER_ID)
LEFT JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
JOIN HD_STATUS ON (HD_STATUS.ID = HD_TICKET.HD_STATUS_ID)
JOIN HD_DUE_DATE ON (HD_STATUS.ID = HD_TICKET.DUE_DATE_ID)
JOIN HD_PRIORITY ON (HD_PRIORITY.ID = HD_TICKET.HD_PRIORITY_ID)
WHERE (HD_TICKET.HD_QUEUE_ID != 5) AND ((TIMESTAMP(HD_TICKET.TIME_CLOSED) <= NOW() AND TIMESTAMP(HD_TICKET.TIME_CLOSED) > DATE_SUB(NOW(),INTERVAL 30 DAY))) AND (HD_STATUS.NAME = 'Closed') ORDER BY CATEGORY
-------------------------------------------------------------------------------------------------------------
Thanks in advance!
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
aragorn.2003
9 years ago
Just remove this line.
JOIN HD_DUE_DATE ON (HD_STATUS.ID = HD_TICKET.DUE_DATE_ID)
cause the column DUE_DATE is a column of the HD_TICKET table.
Comments:
-
Thanks Aragorn! - TXgroup 9 years ago