Query to get Due date difference calculation in hours.
Version : 10609
DB : Postgres
Output:
SELECT wo.WORKORDERID AS "Request ID",
aau.FIRST_NAME AS "Requester",
qd.QUEUENAME AS "Group",
wo.TITLE AS "Subject",
std.STATUSNAME AS "Request Current Status",
longtodate(wh.operationtime) AS "Due Date changed",
ti.FIRST_NAME AS "Due by Time Changed Technician" ,
longtodate(cast(whd.prev_value as bigint)) AS "Previous Due by Time",
longtodate(cast(whd.current_value as bigint)) AS "Current Due by time",
case when cast(whd.prev_value as bigint) > 0 and ((((cast(whd.current_value as bigint))-(cast(whd.prev_value as bigint)))/1000)/(3600)) > 8 THEN 'Include' ELSE 'Exclude' END AS "Due date change exceeds Info" FROM WorkOrder wo
LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID
LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID
LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID
LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID
LEFT JOIN WorkOrderHistory wh ON wo.WORKORDERID=wh.WORKORDERID
LEFT JOIN WorkOrderHistoryDiff whd ON wh.HISTORYID=whd.HISTORYID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID
LEFT JOIN SDUser td ON wh.operationownerid=td.USERID
LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID
WHERE wo.ISPARENT='1' and wh.operation like 'UPDATE' and whd.columnname like 'DUEBYTIME' and wo.createdtime >= <from_thismonth> and wo.createdtime <= <to_thismonth>
New to ADSelfService Plus?