SELECT wo.WORKORDERID "Request ID", wo.TITLE "Subject", aau.FIRST_NAME "Requester", ti.FIRST_NAME "Technician", std.STATUSNAME "Request Status", pd.PRIORITYNAME "Priority", longtodate(wo.CREATEDTIME) "Created Time", aau1.FIRST_NAME PERFORMEDBY, LONGTODATE(OPERATIONTIME) OPERATIONTIME, au1.first_name "Changed From", au2.first_name "Changed To" FROM WorkOrder wo 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 SubCategoryDefinition scd ON wos.SUBCATEGORYID=scd.SUBCATEGORYID 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 LEFT JOIN workorderhistory woh ON wo.workorderid=woh.workorderid LEFT JOIN WorkOrderHistoryDiff wohd ON woh.HISTORYID = wohd.HISTORYID LEFT JOIN AaaUser aau1 ON aau1.USER_ID = woh.OPERATIONOWNERID LEFT JOIN aaauser au1 ON cast(cast(wohd.prev_value AS varchar) AS int)=au1.user_id LEFT JOIN aaauser au2 ON cast(cast(wohd.current_value AS varchar) AS int)=au2.user_id WHERE wohd.COLUMNNAME IN ('OWNERID') AND wo.CREATEDTIME >= <from_thisweek> AND wo.CREATEDTIME <= <to_thisweek> ORDER BY 1