SELECT DISTINCT A.PROBINST , A.SETID , A.SHIP_TO_CUST_ID , B.NAME1 , B.NAMESHORT FROM PS_PL_ORD_SCHEDULE A , PS_CUSTOMER B , PS_SET_CNTRL_REC C , PS_MASTER_ITEM_TBL D WHERE (A.SETID <> ' ' AND A.SHIP_TO_CUST_ID = B.CUST_ID AND C.SETID = D.SETID AND C.SETID = A.SETID AND C.RECNAME = 'MASTER_ITEM_TBL' AND C.SETCNTRLVALUE = A.SHIP_FROM_BU AND D.INV_ITEM_ID = A.INV_ITEM_ID) OR (A.BUSINESS_UNIT <> ' ' AND A.SHIP_TO_CUST_ID = B.CUST_ID AND C.SETID = D.SETID AND C.RECNAME = 'MASTER_ITEM_TBL' AND C.SETCNTRLVALUE = A.BUSINESS_UNIT AND D.INV_ITEM_ID = A.INV_ITEM_ID)
|