Ticket type not recognized command in report. [updated]

Ticket type not recognized command in report. [updated]

Hello,


Maybe you can assist in a query, what I need to setup. At the moment we have a script (see below) it's nice as I can see handled tickets. But I'm in a need for more advanced script. The need is ti to have it scheduled every 3h or at least once in a day. And the report should contain something like:


As the current query I need to manually change dates to see handled tickets and remove duplicates after exported to excel, and it groups the tickets under technician.

Can you help to make it so every time the scheduled  report comes in it dynamically changes the dates and the sorting is like in the picture - Request ID, Request type, Created time, Technician.


The query at the moment:

select wo.workorderid "Request id",(re.first_name) "Technician",
case when woh.operation='RESOLVED' then 'Resolved'
when woh.operation='CLOSE' then  'Closed'
when woh.operation='UPDATE' then 'Modify' else null end "Operation" from workorderhistory woh
left join workorder wo on woh.workorderid=wo.workorderid
left join aaauser re on woh.operationownerid=re.user_id
INNER JOIN HelpDeskCrew ON re.USER_ID=HelpDeskCrew.TECHNICIANID where woh.operation in ('RESOLVED','CLOSE','UPDATE') and
dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.createdtime/1000),'1970-01-01 00:00:00') >= convert(varchar,'2017-01-19 00:00',21) and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.createdtime/1000),'1970-01-01 00:00:00') <= convert(varchar,'2017-01-19 23:59',21) order by 2,3


Thank you in advance!

                New to ADManager Plus?

                  New to ADSelfService Plus?