Query report on Maintenance module (MSSQL & PGSQL)

Query report on Maintenance module (MSSQL & PGSQL)


SELECT ad.ORG_NAME "Customer",

       swo.WORKORDERID "Scheduled WOID",

       ti.SCHEDULE_TIME "Next Schedule Time",

       aau.FIRST_NAME "Requester",

       sdo.NAME "Site",

       dpt.DEPTNAME "Department",

       cd.CATEGORYNAME "Category",

       scd.NAME "Subcategory",

       icd.NAME "Item",

       qd.QUEUENAME "Group",

       ati.FIRST_NAME "Technician",

       swo.TITLE "Subject",

       std.STATUSNAME "Request Status" FROM sworkorder swo

LEFT JOIN SDUser sdu ON swo.REQUESTERID=sdu.USERID

LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID

LEFT JOIN SiteDefinition siteDef ON swo.SITEID=siteDef.SITEID

LEFT JOIN SDOrganization sdo ON siteDef.SITEID=sdo.ORG_ID

LEFT JOIN SWorkOrderStates swos ON swo.WORKORDERID=swos.WORKORDERID

LEFT JOIN QueueDefinition qd ON swos.QUEUEID=qd.QUEUEID

LEFT JOIN CategoryDefinition cd ON swos.CATEGORYID=cd.CATEGORYID

LEFT JOIN SubCategoryDefinition scd ON swos.SUBCATEGORYID=scd.SUBCATEGORYID

LEFT JOIN ItemDefinition icd ON swos.ITEMID=icd.ITEMID

LEFT JOIN SDUser td ON swos.OWNERID=td.USERID

LEFT JOIN AaaUser ati ON td.USERID=ati.USER_ID

LEFT JOIN StatusDefinition std ON swos.STATUSID=std.STATUSID

LEFT JOIN SREQTASK_INPUT si ON si.WORKORDERID=swo.WORKORDERID

LEFT JOIN task_input ti ON ti.INSTANCE_ID = si.INSTANCE_ID

LEFT JOIN schedule s ON ti.SCHEDULE_ID = s.SCHEDULE_ID

LEFT JOIN UserDepartment ud ON aau.USER_ID=ud.USERID

LEFT JOIN DepartmentDefinition dpt ON ud.DEPTID=dpt.DEPTID

left join accountsitemapping asm on asm.siteid = swo.siteid

Left join accountdefinition ad on asm.accountid = ad.org_id

                  New to ADSelfService Plus?