I was under the impression that because there is a common data between some tables that makes DBA/EVO a "relational database"
Anyways, here is what I use for Purchase Orders: The Purchase Order Number is the "relation" between the two tables.
Please use them with care, and as I suspected, there are Orphan records.
'POs WITH NO LINES
SELECT
BKAPPO.BKAP_PO_NUM,
BKAPPOL.BKAP_POL_CNTR
FROM BKAPPO LEFT JOIN BKAPPOL ON BKAPPO.BKAP_PO_NUM = BKAPPOL.BKAP_POL_PONM
WHERE (((BKAPPOL.BKAP_POL_PONM) Is Null));
SELECT
BKAPHPO.BKAP_PO_NUM,
BKAPHPOL.BKAP_POL_CNTR
FROM BKAPHPO LEFT JOIN BKAPHPOL ON BKAPHPO.BKAP_PO_NUM = BKAPHPOL.BKAP_POL_PONM
WHERE (((BKAPHPOL.BKAP_POL_PONM) Is Null));
'POs LINES WITH NO PO HEADER
SELECT
BKAPPOL.BKAP_POL_PONM,
BKAPPOL.BKAP_POL_CNTR
FROM BKAPPO RIGHT JOIN BKAPPOL ON BKAPPO.BKAP_PO_NUM = BKAPPOL.BKAP_POL_PONM
WHERE (((BKAPPO.BKAP_PO_NUM) Is Null));
SELECT
BKAPHPOL.BKAP_POL_PONM,
BKAPHPOL.BKAP_POL_CNTR
FROM BKAPHPO RIGHT JOIN BKAPHPOL ON BKAPHPO.BKAP_PO_NUM = BKAPHPOL.BKAP_POL_PONM
WHERE (((BKAPHPO.BKAP_PO_NUM) Is Null));
Kelloggs