You are html tracking Visitor

Saturday, September 6, 2008

Invoices Associated with the Given Purchase Order Number

PO: Invoices Associated with the Given Purchase Order Number:-
------------------------------------------------------------------------------------------------------------------

SELECT aip.invoice_id invoice_id,
b.po_number po_number
FROM ap_invoices_all aip,
(SELECT invoice_id,po_number FROM ( SELECT ai.invoice_id,
AP_INVOICES_PKG.GET_PO_NUMBER( ai.invoice_id) po_number
FROM AP_INVOICES_ALL AI) A
WHERE a.po_number <>'UNMATCHED') b
where b.invoice_id=aip.invoice_id
and b.po_number= ‘Purchase Order Number’;

2 comments:

mk said...

Does not work for me. What about this simple SQL:

select i.invoice_num from ap_invoices_all i, ap_invoice_distributions_all aid, po_distributions_all pd, po_headers_all ph
where i.invoice_id = aid.invoice_id
and aid.po_distribution_id = pd.po_distribution_id
and pd.po_header_id=ph.po_header_id
and ph.segment1='Your PO-Number;

phani said...

Well all the time the above query has worked for me. Your query also look good. Thanks to mk for sharing with us.

have a great day.

Thanks and regards,
Phani