/build/static/layout/Breadcrumb_cap_w.png

Supportdesk report

Dears,

I'm not an expert in SQL but can't figure out what I'm doing wrong.
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

0 Comments   [ + ] Show comments

Answers (1)

Posted by: chucksteel 7 years ago
Red Belt
1
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

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