Helpdesk Report for unresolved tickets
I would like to include the last update in the report
I have this script to include the last comment or note added to a ticket in an unresolved ticket report. But it adds all the font info the note field etc. Please see the picture attached
Select Top 1000000 htblticket.date As [Creation Date],
htblticket.ticketid As [Ticket ID],
htblusers.name As [Requestor Name],
htblticket.subject As Subject,
htblticketstates.statename As Status,
htbltickettypes.typename As [Ticket Type],
htblticketstates.description As [Ticket State],
htblusers1.name As [Agent Responsible],
htblsource.icon As icon,
DateDiff(day, htblticket.date, GetDate()) As [Days Since Creation],
htblticket.deadline,
htblsource.name As Source,
LastNote.name As [Last Updated by],
LastNote.note As [Last Update]
From htblticket
Inner Join htblpriorities On htblpriorities.priority = htblticket.priority
Inner Join htblticketstates On htblticketstates.ticketstateid =
htblticket.ticketstateid
Inner Join htblusers On htblusers.userid = htblticket.fromuserid
Left Join htblagents On htblagents.agentid = htblticket.agentid
Left Join htblusers htblusers1 On htblusers1.userid = htblagents.userid
Inner Join htbltickettypes On htblticket.tickettypeid =
htbltickettypes.tickettypeid
Inner Join htblsource On htblticket.sourceid = htblsource.sourceid
Inner Join htblusers htblusers2 On htblticket.userid_lastnote =
htblusers2.userid
Inner Join (Select a.ticketid,
a.date,
a.note,
c.name
From htblnotes a
Left Join (Select htblnotes.ticketid,
Max(htblnotes.date) As date
From htblnotes
Group By htblnotes.ticketid) b On a.ticketid = b.ticketid
Left Join htblusers c On a.userid = c.userid
Where a.date = b.date) LastNote On htblticket.ticketid = LastNote.ticketid
Where htblticketstates.statename <> 'Closed'
Order By [Agent Responsible],
[Days Since Creation]