Supportdesk report
Dears,
I'm not an expert in SQL but can't figure out what I'm doing wrong.
My current code is:
My current code is:
SELECT
HD_TICKET.ID,
HD_TICKET.TIME_OPENED,
S.FULL_NAME AS SUBMITTER_NAME,
O.FULL_NAME AS OWNER_NAME,
O.FULL_NAME AS OWNER_NAME,
HD_TICKET.TIME_CLOSED,
HD_TICKET.TITLE,
HD_QUEUE.ID,
HD_TICKET.DUE_DATE,
HD_PRIORITY.NAME AS PRIORITY,
HD_QUEUE.ID,
HD_QUEUE.ID,
HD_QUEUE.ID,
HD_TICKET.CUSTOM_FIELD_VALUE2,
HD_TICKET.CUSTOM_FIELD_VALUE1,
HD_CATEGORY.NAME AS CATEGORY,
HD_QUEUE.ID,
HD_QUEUE.ID
FROM
HD_TICKET JOIN
HD_QUEUE Q ON Q.ID = HD_TICKET.HD_QUEUE_ID
JOIN
USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
JOIN
USER O ON (O.ID = HD_TICKET.OWNER_ID)
JOIN
HD_CATEGORY ON (HD_CATEGORY.ID = HD_TICKET.HD_CATEGORY_ID)
JOIN
HD_IMPACT ON (HD_IMPACT.ID = HD_TICKET.HD_IMPACT_ID)
JOIN
HD_PRIORITY ON (HD_PRIORITY.ID = HD_TICKET.HD_PRIORITY_ID)
JOIN
HD_STATUS ON (HD_STATUS.ID = HD_TICKET.HD_STATUS_ID)
WHERE
(HD_TICKET.HD_QUEUE_ID in (7,12,13))
AND
(HD_TICKET.CREATED > DATE_SUB(NOW(), INTERVAL 31 DAY))
AND ORDER BY
HD_TICKET.CREATED
But K1000 is not accepting it, what am I doing wrong?
Thanks in advance!
Regards,
Wesley
Thanks in advance!
Regards,
Wesley
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
chucksteel
8 years ago
Remove the AND that proceeds the ORDER BY statement:
WHERE
(HD_TICKET.HD_QUEUE_ID in (7,12,13))
AND
(HD_TICKET.CREATED > DATE_SUB(NOW(), INTERVAL 31 DAY))
AND ORDER BY
HD_TICKET.CREATED
Should be:
WHERE
(HD_TICKET.HD_QUEUE_ID in (7,12,13))
AND
(HD_TICKET.CREATED > DATE_SUB(NOW(), INTERVAL 31 DAY))
ORDER BY
HD_TICKET.CREATED