Need a SQL Query Help To Fetch Non-PO Matched Invoice Lines (Account Payables)
Summary: Our requirement is to fetch the Non-PO matched invoices, the query should even exclude Invoice lines which are associated with PO.
Only Invoices without PO (at header & line level) need to be retrieved from SQL query
Code Snippet (add any code snippets that support your topic, if applicable):
Sample Query:
It fetches invoice with po at line level. Could you please help to revise the query.
SELECT
aia.invoice_num invoice_number,
aia.invoice_date,
aia.invoice_amount
FROM ap_invoices_all aia,
ap_invoice_lines_all aila
WHERE aia.invoice_id=aila.invoice_id
and (aila.po_header_id is null and aila.po_line_id is null and aila.rcv_transaction_id is null)
0