Custom Query

Custom Query

Alert Message
SQL Error: The data types float and int are incompatible in the modulo operator.

SELECT 
    FORMAT(DATEADD(SECOND, wo.CREATEDTIME / 1000, '1970-01-01'), 'dd.MM.yyyy HH:mm') AS [Created Time],
    wo.WORKORDERID AS [Request ID],
    std.STATUSNAME AS [Request Status],
    Request_UDF_PickListValues_UDF_PICK1.VALUE AS [Ünvan],
    aau.FIRST_NAME AS [Requester],
    serdef.NAME AS [Service Category],
    rtl.TEMPLATENAME AS [Template Name],
    wo.TITLE AS [Subject],
    wotodesc.FULLDESCRIPTION AS [Description],
    FORMAT(DATEADD(SECOND, wos.ASSIGNEDTIME / 1000, '1970-01-01'), 'dd.MM.yyyy HH:mm') AS [Assigned Time],
    FORMAT(DATEADD(SECOND, wo.RESOLVEDTIME / 1000, '1970-01-01'), 'dd.MM.yyyy HH:mm') AS [Resolved Time],
    CONCAT(
        CAST(FLOOR(CAST(wo.TIMESPENTONREQ AS BIGINT) / (1000 * 60 * 60 * 24)) AS VARCHAR), 'd ',
        RIGHT('0' + CAST(FLOOR(CAST(wo.TIMESPENTONREQ AS BIGINT) / (1000 * 60 * 60) % 24) AS VARCHAR), 2), ':',
        RIGHT('0' + CAST(FLOOR(CAST(wo.TIMESPENTONREQ AS BIGINT) / (1000 * 60) % 60) AS VARCHAR), 2), ':',
        RIGHT('0' + CAST(FLOOR(CAST(wo.TIMESPENTONREQ AS BIGINT) / 1000 % 60) AS VARCHAR), 2)
    ) AS [Time Elapsed],
    ti.FIRST_NAME AS [Technician],
    qd.QUEUENAME AS [Group],
    wos.ISOVERDUE AS [Overdue Status],
    wos.IS_CANCEL_REQUESTED AS [Cancellation Requested],
    wo.ONHOLDTIME AS [Onhold Time],
    std.ISPENDING AS [Pending Status]
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 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 RequestTemplate_List rtl ON wo.TEMPLATEID = rtl.TEMPLATEID
LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID = woq.WORKORDERID
LEFT JOIN QueueDefinition qd ON woq.QUEUEID = qd.QUEUEID
LEFT JOIN WorkOrderToDescription wotodesc ON wo.WORKORDERID = wotodesc.WORKORDERID
LEFT JOIN ServiceDefinition serdef ON wo.SERVICEID = serdef.SERVICEID
LEFT JOIN Request_Additional_Fields_2 raf2 ON wo.WORKORDERID = raf2.WORKORDERID
LEFT JOIN Request_UDF_PickListValues Request_UDF_PickListValues_UDF_PICK1 ON raf2.UDF_PICK1 = Request_UDF_PickListValues_UDF_PICK1.PickListID
WHERE 
    wo.ISPARENT = 1;

                  New to ADSelfService Plus?