Hi
I am trying to get a report that can be scheduled that will show all open requests that are still open and were created over 7 days a go. Can anyone help with this query:
SELECT ti.FIRST_NAME AS "Technician", ti.FIRST_NAME AS "Technician", wo.WORKORDERID AS "Request ID", sdo.NAME AS "Site", aau.FIRST_NAME AS "Requester", longtodate(wo.CREATEDTIME) AS "Created Time", longtodate(wos.LAST_TECH_UPDATE) AS "Last Update Time", std.STATUSNAME AS "Request Status", wo.TITLE AS "Subject" 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 SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID WHERE ( ( std.ISPENDING = true ) AND ( ( ( longtodate(wo.CREATEDTIME) >= 1577836800000 ) AND ( ( longtodate(wo.CREATEDTIME) != 0 ) AND ( longtodate(wo.CREATEDTIME) IS NOT NULL ) ) ) AND ( ( longtodate(wo.CREATEDTIME) <= 1609459199000 ) AND ( ( ( longtodate(wo.CREATEDTIME) != 0 ) AND ( longtodate(wo.CREATEDTIME) IS NOT NULL ) ) AND ( longtodate(wo.CREATEDTIME) != -1 ) ) ) ) ) AND wo.ISPARENT='1' ORDER BY 1, 6