SELECT DISTINCT (A.WO_CONID) , A.TE_TEMPLATE_ID , A.BUSINESS_UNIT , F.DESCR , A.WORK_ORDER_ID , A.JOB_TITLE , B.VMS_SUPPLIER_ID , V.NAME1 FROM PS_SPF_WORDERREC A , PS_SPF_WORDERREC_1 B , PS_BUS_UNIT_TBL_FS F , PS_SET_CNTRL_GROUP G , PS_VENDOR V WHERE ((A.WO_STATUS IN ('L','C','F','T')) OR (A.WO_STATUS = 'N' AND EXISTS ( SELECT '*' FROM PS_SPF_WO_HISTORY H WHERE H.BUSINESS_UNIT = A.BUSINESS_UNIT AND H.WORK_ORDER_ID = A.WORK_ORDER_ID AND H.WO_STATUS = 'L'))) AND A.SERVICE_METHOD = 'D' AND A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.WORK_ORDER_ID = B.WORK_ORDER_ID AND F.BUSINESS_UNIT = A.BUSINESS_UNIT AND B.BUSINESS_UNIT = G.SETCNTRLVALUE AND G.SETID = V.SETID AND G.REC_GROUP_ID = 'FS_38' AND B.VMS_SUPPLIER_ID = V.VENDOR_ID
|