RFQ - 317 ; QUOTATION - 517 ; PO - 6128 1) If we provide PO number, query should populate RFQ and Quotation num. SELECT R.SEGMENT1 AS RFQ_NUM, Q.SEGMENT1 AS QUOTATION_NUM FROM PO_HEADERS_ALL R, PO_HEADERS_ALL Q, PO_HEADERS_ALL P WHERE R.PO_HEADER_ID = Q.FROM_HEADER_ID AND Q.PO_HEADER_ID = P.FROM_HEADER_ID AND P.SEGMENT1 = '6128';
2) If we provide RFQ number , query should provide PO number and Quotation number SELECT P.SEGMENT1 AS PO_NUMBER, Q.SEGMENT1 AS QUOTATION_NUM FROM PO_HEADERS_ALL R, PO_HEADERS_ALL Q, PO_HEADERS_ALL P WHERE R.PO_HEADER_ID = Q.FROM_HEADER_ID AND Q.PO_HEADER_ID = P.FROM_HEADER_ID AND R.SEGMENT1 = '317';
3) If we provide Quotatio number, query should provide PO number and RFQ number SELECT P.SEGMENT1 AS PO_NUMBER, R.SEGMENT1 AS RFQ_NUM FROM PO_HEADERS_ALL R, PO_HEADERS_ALL Q, PO_HEADERS_ALL P WHERE R.PO_HEADER_ID = Q.FROM_HEADER_ID AND Q.PO_HEADER_ID = P.FROM_HEADER_ID AND Q.SEGMENT1 = '517';