SELECT DISTINCT A.BUSINESS_UNIT , A.VOUCHER_ID , A.BUSINESS_UNIT_RECV , A.RECEIVER_ID , A.RECV_LN_NBR , A.RECV_SHIP_SEQ_NBR FROM PS_VCHR_RECV_MTCH A , PS_VOUCHER_LINE B WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.VOUCHER_ID = B.VOUCHER_ID AND A.VOUCHER_LINE_NUM = B.VOUCHER_LINE_NUM UNION SELECT DISTINCT C.BUSINESS_UNIT , C.VOUCHER_ID , C.BUSINESS_UNIT_RECV , C.RECEIVER_ID , C.RECV_LN_NBR , C.RECV_SHIP_SEQ_NBR FROM PS_VOUCHER_LINE C WHERE C.RECEIVER_ID <> ' ' AND NOT EXISTS ( SELECT 'X' FROM PS_VCHR_RECV_MTCH D WHERE D.BUSINESS_UNIT = C.BUSINESS_UNIT AND D.VOUCHER_ID = C.VOUCHER_ID AND D.VOUCHER_LINE_NUM = C.VOUCHER_LINE_NUM AND D.BUSINESS_UNIT_RECV = C.BUSINESS_UNIT_RECV AND D.RECEIVER_ID = C.RECEIVER_ID AND D.RECV_LN_NBR = C.RECV_LN_NBR AND D.RECV_SHIP_SEQ_NBR = C.RECV_SHIP_SEQ_NBR AND D.BUSINESS_UNIT_PO = C.BUSINESS_UNIT_PO AND D.PO_ID = C.PO_ID AND D.LINE_NBR = C.LINE_NBR AND D.SCHED_NBR = C.SCHED_NBR)
|