I need to write a query that gives me all APIs with no APMs (API and APM are source code fields). The common field would be the invoice.
API = paid invoices
APM = voided invoices
So the objective is to get a list of all invoices that have not been voided. The starting code is listed below.
SELECT dbo_gl_history.j_jnl_source AS Source, dbo_gl_history.a_org AS Org, dbo_gl_history.a_object AS [Object], dbo_gl_history.a_project AS Project, dbo_gl_history.j_jnl_year_period AS YrPd, dbo_gl_history.a_journal_number AS Journal, dbo_gl_history.h_ref1_vendor AS Vendor, dbo_gl_history.h_ref2_po_no AS PO, dbo_gl_history.h_ref3_invoice_no AS Invoice, dbo_gl_history.h_effective_date AS [Eff Date], dbo_gl_history.h_gross_amount AS Amount
FROM dbo_gl_history
WHERE (((dbo_gl_history.j_jnl_source)="API" Or (dbo_gl_history.j_jnl_source)="APM") AND ((dbo_gl_history.a_object) Like "7*") AND ((dbo_gl_history.a_fund_seg1) Like "3*" Or (dbo_gl_history.a_fund_seg1) Like "4*"))
ORDER BY dbo_gl_history.a_org, dbo_gl_history.a_object, dbo_gl_history.a_project;
Any help you give would be greatly appreciated.
Thanks,
Kathy