John,
Your query runs almost instantly, however it's returning some records that are duplicates. For example I got part number 2300163 with vendor 56255 twelve times. How would I add an index to the SQL table?
Doyce
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
Doyce-
On Mar 7, 2014, at 7:11 PM, <winberry.doyce@...> <winberry.doyce@...> wrote: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 (5) |
Tidak ada komentar:
Posting Komentar