→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎05-28-2019 08:49 PM
‎06-03-2019 01:15 PM
We've added a few subqueries to your report that incorporate the ticket custom fields you've highlighted in your report. If you'd like to apply this for other custom fields or in other reports in the future, we've highlighted the values you should replace with the custom field name in yellow and the subquery in green.SELECT DISTINCT TOP 1000000 htblticket.ticketid,
htblticket.subject,
htblusers1.name AS Agent,
htblusers.name AS Requester,
htblticket.priority,
htblticket.date,
htblticket.updated,
htblticketstates.statename,
htblticket.assetid,
Ticket.data AS Ticket,
ImportID.data AS ImportID,
WSID.Data AS WSID
FROM htblticket
INNER JOIN htblnotes ON htblticket.ticketid = htblnotes.ticketid
INNER JOIN htblusers ON htblusers.userid = htblticket.fromuserid
INNER JOIN htblticketstates ON htblticketstates.ticketstateid = htblticket.ticketstateid
INNER JOIN htblagents ON htblagents.agentid = htblticket.agentid
INNER JOIN htblusers htblusers1 ON htblusers1.userid = htblagents.userid
AND htblusers.userid = htblnotes.userid
LEFT JOIN
(
SELECT TOP 1000000 htblticketcustomfield.ticketid,
htblticketcustomfield.data
FROM htblticketcustomfield
INNER JOIN htblcustomfields ON htblcustomfields.fieldid = htblticketcustomfield.fieldid
WHERE htblcustomfields.name LIKE 'Ticket'
) AS Ticket ON Ticket.ticketid = htblticket.ticketid
LEFT JOIN
(
SELECT TOP 1000000 htblticketcustomfield.ticketid,
htblticketcustomfield.data
FROM htblticketcustomfield
INNER JOIN htblcustomfields ON htblcustomfields.fieldid = htblticketcustomfield.fieldid
WHERE htblcustomfields.name LIKE 'ImportID'
) AS ImportID ON ImportID.ticketid = htblticket.ticketid
LEFT JOIN
(
SELECT TOP 1000000 htblticketcustomfield.ticketid,
htblticketcustomfield.data
FROM htblticketcustomfield
INNER JOIN htblcustomfields ON htblcustomfields.fieldid = htblticketcustomfield.fieldid
WHERE htblcustomfields.name LIKE 'WSID'
) AS WSID ON WSID.ticketid = htblticket.ticketid
WHERE htblticketstates.statename = 'Closed' AND htblticket.updated > GetDate() - 30
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now