Query to get Created Date changed info of the request

Query to get Created Date changed info of the request

Version : OVER 14000 series
DB : MSSQL

OUTPUT :




Query:

SELECT "wo"."WORKORDERID" AS "Request ID",
longtodate("wo"."CREATEDTIME") AS "Created Time",
"cri"."FIRST_NAME" AS "Created By",
"ti"."FIRST_NAME" AS "Support Rep",
"qd"."QUEUENAME" AS "Group",
"cd"."CATEGORYNAME" AS "Category",
"scd"."NAME" AS "Subcategory",
"wo"."TITLE" AS "Subject",
longtodate(cast(cast(wohd.PREV_VALUE AS varchar) AS bigint)) AS "Actual Value",
longtodate(cast(cast(wohd.current_value AS varchar) AS bigint)) AS "Changed Value" FROM "WorkOrder" "wo"
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 "SubCategoryDefinition" "scd" ON "wos"."SUBCATEGORYID"="scd"."SUBCATEGORYID"
LEFT JOIN "WorkOrder_Queue" "woq" ON "wo"."WORKORDERID"="woq"."WORKORDERID"
LEFT JOIN "QueueDefinition" "qd" ON "woq"."QUEUEID"="qd"."QUEUEID"
LEFT JOIN "SDUser" "crd" ON "wo"."CREATEDBYID"="crd"."USERID"
LEFT JOIN "AaaUser" "cri" ON "crd"."USERID"="cri"."USER_ID"
LEFT JOIN workorderhistory woh ON wo.workorderid=woh.workorderid
LEFT JOIN workorderhistorydiff wohd ON woh.historyid=wohd.historyid WHERE  wo.ISPARENT='1' and wohd.columnname='CREATEDTIME' and ( ( ( "wo"."CREATEDTIME" >= datetolong('2023-08-01') ) AND ( ( "wo"."CREATEDTIME" != 0 ) AND ( "wo"."CREATEDTIME" IS NOT NULL ) ) ) AND ( ( "wo"."CREATEDTIME" <= 1693540799000 ) AND ( ( ( "wo"."CREATEDTIME" != 0 ) AND ( "wo"."CREATEDTIME" IS NOT NULL ) ) AND ( "wo"."CREATEDTIME" != -1 ) ) ) )

                  New to ADSelfService Plus?