Create report with Last Update time

Create report with Last Update time


I am trying to run this report however I get the error "only select statements can be used". Can you please help?

SELECT ti.FIRST_NAME "Technician",wo.WORKORDERID "Request ID",aau.FIRST_NAME "Requester",cd.CATEGORYNAME "Category",ti.FIRST_NAME "Technician",sdo.NAME "Site",longtodate(wos.LAST_TECH_UPDATE) "Last Update Time" FROM WorkOrder wo LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID LEFT JOIN SiteDefinition siteDef ON wo.SITEID=siteDef.SITEID LEFT JOIN SDOrganization sdo ON siteDef.SITEID=sdo.ORG_ID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN CategoryDefinition cd ON wos.CATEGORYID=cd.CATEGORYID LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN PriorityDefinition pd ON wos.PRIORITYID=pd.PRIORITYID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID WHERE  ((std.STATUSNAME = N'Onhold' COLLATE SQL_Latin1_General_CP1_CI_AS) OR (std.STATUSNAME = N'Open' COLLATE SQL_Latin1_General_CP1_CI_AS))  AND wos.LAST_TECH_UPDATE < dateadd(day, -1, getdate()) AND wo.ISPARENT='1'  ORDER BY 1, 7,  pd.PRIORITYNAME

The goal is to create a report of tickets that have not been updated in XX amount of time (currently the query is set to 1 day).

This is version 8.2 running on MSSQL.