I do believe a query such as the following might get one somewhat closer to the desired result...
SELECT PM80500_2.TRXSORCE, PM80500_2.VCHRNMBR, PM80500_2.DOCTYPE, PM80500_2.APFRDCNM, PM80500_2.VENDORID,
PM80500_2.APTVCHNM, PM80500_2.APTODCTY, PM80500_2.APTODCNM, PM80500_2.APPLDAMT, PM80500_2.DISTKNAM, PM80500_2.WROFAMNT,
PM80500_2.PPSAMDED, PM80500_2.GSTDSAMT, PM80500_2.TAXDTLID, PM80500_2.POSTEDDT, PM80500_2.PTDUSRID, PM80500_2.TEN99AMNT,
PM80500_2.DISAVTKN, PM80500_2.DOCDATE, PM80500_2.APTODCDT, PM80500_2.KEYSOURC, PM80500_2.ORAPPAMT, PM80500_2.ORDISTKN,
PM80500_2.ORWROFAM, PM80500_2.ORDATKN, PM80500_2.RLGANLOS, PM80500_2.DEX_ROW_ID, a.DOCNUMBR AS CkNum, a.VCHRNMBR AS CkVchrnmbr
FROM dbo.PM80500 WITH (nolock) INNER JOIN
(SELECT dbo.PM30200.DOCNUMBR, dbo.PM30200.VCHRNMBR, MIN(PM80500_1.DEX_ROW_ID) AS DEX_ROW, dbo.PM30200.VENDORID
FROM dbo.PM80500 AS PM80500_1 WITH (nolock) INNER JOIN
dbo.PM30200 ON PM80500_1.VCHRNMBR = dbo.PM30200.VCHRNMBR
WHERE (dbo.PM30200.DOCTYPE = 6)
GROUP BY dbo.PM30200.VCHRNMBR, dbo.PM30200.DOCNUMBR, dbo.PM30200.VENDORID) AS a ON dbo.PM80500.DEX_ROW_ID + 1 = a.DEX_ROW AND
dbo.PM80500.VENDORID = a.VENDORID RIGHT OUTER JOIN
dbo.PM80500 AS PM80500_2 WITH (nolock) ON dbo.PM80500.KEYSOURC = CASE PM80500_2.KEYSOURC WHEN '' THEN NULL
ELSE PM80500_2.KEYSOURC END
GROUP BY a.DOCNUMBR, PM80500_2.TRXSORCE, PM80500_2.VCHRNMBR, PM80500_2.DOCTYPE, PM80500_2.APFRDCNM, PM80500_2.VENDORID, PM80500_2.APTVCHNM,
PM80500_2.APTODCTY, PM80500_2.APTODCNM, PM80500_2.APPLDAMT, PM80500_2.DISTKNAM, PM80500_2.WROFAMNT, PM80500_2.PPSAMDED,
PM80500_2.GSTDSAMT, PM80500_2.TAXDTLID, PM80500_2.POSTEDDT, PM80500_2.PTDUSRID, PM80500_2.TEN99AMNT, PM80500_2.DISAVTKN,
PM80500_2.DOCDATE, PM80500_2.APTODCDT, PM80500_2.KEYSOURC, PM80500_2.ORAPPAMT, PM80500_2.ORDISTKN, PM80500_2.ORWROFAM,
PM80500_2.ORDATKN, PM80500_2.RLGANLOS, PM80500_2.DEX_ROW_ID, a.VCHRNMBR
ORDER BY PM80500_2.DEX_ROW_ID
The query is based primarily upon the PM80500 table. Check numbers associated with previously non-associable items should show up in the CkNum column... A simple CASE statement in the "SELECT" portion of the query will allow you to consolidate check numbers into one column if desired. In my situation, I find it desirable to create a view and union a subset of this data to create separate record appearances for invoices and credits that might offset one another in summing/reconciling to the total check amount. Many thanks to Victoria and jcw12000 for turning me on to the PM80500 table. I've been wrestling with the PM30200 and PM30300 tables forever trying to get payables "history" data to look like this.
DISCLAIMER:
The query in the above form was created based on some assumptions that may not turn out to be true (and specifically may turn out to be true in some implementations and not others)... It is somewhat untested. USE AT YOUR OWN RISK.
If this helps accomplish your purposes or if it doesn't appear to work at all, I'd definitely appreciate feedback either way.
John Picklesimer CPA