Edit the datelimit and then run the query.
select wo.WORKORDERID 'Request ID' ,(select CASE WHEN
wohd.COLUMNNAME = 'OWNERID' THEN 'Technician' ELSE 'GROUP' END ) 'Changes
in',dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +
(wo.CREATEDTIME/1000),'1970-01-01 00:00:00') 'Created
Time',dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (woh.OPERATIONTIME/1000),'1970-01-01
00:00:00') 'Operation Time',dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +
(wo.COMPLETEDTIME/1000),'1970-01-01 00:00:00') 'Closed
Time',((wo.TIMESPENTONREQ/1000)/3600) 'Time Spent (Hrs)',COALESCE((select
QUEUENAME from QueueDefinition where wohd.COLUMNNAME = 'QUEUEID' and (
cast(wohd.PREV_VALUE as varchar) = QUEUEID) ), (select aau.FIRST_NAME from
AaaUser aau where wohd.COLUMNNAME = 'OWNERID' and cast(wohd.PREV_VALUE as
varchar) = aau.USER_ID)) 'Assign From', COALESCE((select QUEUENAME from
QueueDefinition where wohd.COLUMNNAME = 'QUEUEID' and ( cast(wohd.CURRENT_VALUE
as varchar) = QUEUEID) ), (select aau.FIRST_NAME from AaaUser aau where
wohd.COLUMNNAME = 'OWNERID' and cast(wohd.CURRENT_VALUE as varchar) =
aau.USER_ID)) 'Assign To', (select aau.FIRST_NAME from AaaUser aau where
wohd.COLUMNNAME = 'OWNERID' and cast(wohd.PREV_VALUE as varchar) = aau.USER_ID)
'Assign From' from WorkOrder_Threaded wot INNER JOIN WorkOrder wo ON
wot.WORKORDERID = wo.WORKORDERID LEFT JOIN WorkOrderHistory woh ON
wo.WORKORDERID = woh.WORKORDERID LEFT JOIN WorkOrderHistoryDiff wohd ON
woh.HISTORYID = wohd.HISTORYID where wohd.COLUMNNAME in ( 'QUEUEID', 'OWNERID'
) and (wot.THD_WOID = wot.WORKORDERID)and wohd.PREV_VALUE IS NOT NULL and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME
/1000),'1970-01-01 00:00:00')>=('2009-08-01 00:00:00') and dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.CREATEDTIME
/1000),'1970-01-01 00:00:00')<=('2009-08-31 23:59:59')
regards,
Rachana Apu
SDP Support - FAQ
ServiceDesk Plus - Help
Desk Software of your Choice