Selasa, 19 Agustus 2014

[MS_AccessPros] Need help with query syntax

 

Hello friends,

The query below is supposed to select the last time a part was received. However I have discovered if a part is received twice on the same day, it shows up twice and I only want the latest receipt. I have added the TXNTIM_55 field but don't know how to add the max value to the query.

SELECT DISTINCT p.PRTNUM_01, v.VENID_55, [Vendor Master].COMNAM_08 AS Comnam, v.TNXDTE_55, v.TNXTIM_55FROM ([PART MASTER] AS p INNER JOIN [PO Receipts] AS v ON p.PRTNUM_01 = v.PRTNUM_55) INNER JOIN [Vendor Master] ON v.VENID_55 = [Vendor Master].VENID_08
WHERE (((v.TNXDTE_55)=(SELECT Max(TNXDTE_55)
 FROM [PO Receipts] As v2
 WHERE v2.PRTNUM_55 = p.PRTNUM_01)))
ORDER BY p.PRTNUM_01;
Doyce

__._,_.___

Posted by: winberry.doyce@roadsysinc.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar