Query report for both live and archived requests (PGSQL)

Query report for both live and archived requests (PGSQL)

Tested in Build 14306 

Columns -
  1. Request ID
  2. Created Time
  3. Resolved Time
  4. Account
  5. Category
  6. Subcategory
  7. Group

Query -
SELECT wo.WORKORDERID AS "Request ID", wo.CREATEDTIME AS "Created Time", wo.RESOLVEDTIME AS "Resolved Time", ad.ORG_NAME AS "Account", cd.CATEGORYNAME AS "Category", scd.NAME AS "Subcategory", qd.QUEUENAME AS "Group" FROM WorkOrder wo LEFT JOIN WorkOrderAccountMapping wam ON wo.WORKORDERID=wam.WORKORDERID LEFT JOIN PortalAccounts port_acc ON wam.ACCOUNTID=port_acc.ACCOUNTID LEFT JOIN AccountDefinition ad ON port_acc.ACCOUNTID=ad.ORG_ID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN CategoryDefinition cd ON wos.CATEGORYID=cd.CATEGORYID 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 WHERE (wo.ISPARENT='1') UNION SELECT arcwo.WORKORDERID AS "Request ID", arcwo.CREATEDTIME AS "Created Time", arcwo.RESOLVEDTIME AS "Resolved Time", ad.ORG_NAME AS "Account", arcwo.CATEGORYNAME AS "Category", arcwo.SUBCATEGORYNAME AS "Subcategory", arcwo.QUEUENAME AS "Group" FROM Arc_WorkOrder arcwo LEFT JOIN Arc_WorkOrderAccountMapping awm ON arcwo.WORKORDERID=awm.WORKORDERID LEFT JOIN PortalAccounts port_acc ON awm.ACCOUNTID=port_acc.ACCOUNTID LEFT JOIN AccountDefinition ad ON awm.ACCOUNTID=ad.ORG_ID 


                  New to ADSelfService Plus?