John,
Here is the SQL:
SELECT p.PRTNUM_01, (SELECT TOP 1 v.VENID_55
FROM [PO Receipts] AS v
WHERE v.PRTNUM_55=p.PRTNUM_01
ORDER BY v.TNXDTE_55 DESC, v.RECNUM_55) AS LastVendor
FROM [PART MASTER] AS p
ORDER BY p.PRTNUM_01;
PRTNUM_55 and TNXDTE_55 have indexes. VENID_55 does not. PRTNUM_01 is the PK of the PART MASTER table. I am not locked out of the SQL DB but I fear that if I change anything that when my software vendor updates their software package, the updates won't install correctly and they won't give me any support because I changed something on the table. What I'm trying to do is get the VENID from the latest receipt of a part number.
Doyce
__._,_.___
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar