Adding number of days open to report

Adding number of days open to report

Hello,

I would like to the number of days since created to the following report.  This report is being run on a mysql database.  I had opened a ticket before, but did not get any notifications that it had been posted.  I would also like to order by support rep, then number of days open, then customer.

Thank you,
Shawn

SELECT ti.FIRST_NAME "Support Rep",wo.WORKORDERID "Request ID", std.STATUSNAME "Request Status",org.NAME "Account",aau.FIRST_NAME "Contact",wo.TITLE "Subject",cd.CATEGORYNAME "Category",longtodate(wo.CREATEDTIME) "Created Time",longtodate(wo.LASTUPDATED) "Last Updated" FROM WorkOrder_Threaded wot INNER JOIN WorkOrder wo ON wot.WORKORDERID=wo.WORKORDERID LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_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 StatusDefinition std ON wos.STATUSID=std.STATUSID LEFT JOIN WorkOrder_Account woacc ON wo.WORKORDERID=woacc.WORKORDERID LEFT JOIN Customer cust ON woacc.ACCOUNTID=cust.CUSTOMER_ID LEFT JOIN AaaOrganization org ON cust.CUSTOMER_ID=org.ORG_ID WHERE  ((((std.STATUSNAME != 'Closed') OR ( std.STATUSNAME IS NULL)) AND ((std.STATUSNAME != 'Resolved') OR ( std.STATUSNAME IS NULL))) AND (wo.DEPARTMENTID = 1))  AND wot.THD_WOID=wot.WORKORDERID  ORDER BY 1, 3, 8







                New to ADSelfService Plus?