Custom queries

Custom queries

I have the following query which works to extract details by "request type", however how can it be modified to also include extracting the relevant "Customer" as well?? Your help would be most appreciated.

SELECT wo.workorderid 'RequestID',wo.TITLE 'Subject',rtd.name 'RequestType',aau.FIRST_NAME 'Requester',cd.CATEGORYNAME 'Category',scd.NAME 'Sub Category',dateadd(s,wo.CREATEDTIME/1000,'01-01-1970') 'Created Time',dateadd(s,wo.COMPLETEDTIME/1000,'01-01-1970') 'Completed Time',ti.FIRST_NAME 'Technician',pd.PRIORITYNAME 'Priority',dateadd(s,wo.DUEBYTIME/1000,'01-01-1970') 'Dueby Time' FROM WorkOrder_Threaded wot INNER JOIN WorkOrder wo ON wot.WORKORDERID=wo.WORKORDERID 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 CategoryDefinition cd ON wos.CATEGORYID=cd.CATEGORYID LEFT JOIN SubCategoryDefinition scd ON wos.SUBCATEGORYID=scd.SUBCATEGORYID 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 requesttypedefinition rtd on rtd.requesttypeid=wos.requesttypeid WHERE (wot.THD_WOID=wot.WORKORDERID) and wos.requesttypeid != ''


Thanks. Sylvon




                New to ADManager Plus?

                  New to ADSelfService Plus?