Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 AS400/JDE DTS

Author  Topic 

BryanRodrigues
Starting Member

1 Post

Posted - 2008-09-09 : 15:23:07
Hi,

having a problem selecting data from an AS400 DB.

I basically need to collect Quantity (F01.PRUORG), Product(F01.PRLITM), GLDate (F01.PRDGL) and SupplierID (F01.PRAN8) for the most recent receivable transaction that occered.

The query below gives all transaction data, where i only want the data from the last transtaction.

Select F01.PRDCTO,F01.PRLITM,MAX(F01.PRDGL) AS GLDATE, F01.PRUORG, F01.PRAN8
From F43121 F01,F4101 F02 Where(F01.PRLITM=F02.IMLITM) And (F01.PRDCT='OV' And F01.PRDCTO='OP' And F02.IMPRP4='800')
Group By F01.PRDCTO, PRLITM, PRUORG, PRAN8

Examaple of a single product transactions.

PRDCTO PRLITM GLDATE PRUORG PRAN8
OP 0000000001 11/22/2002 10 5895
OP 0000000001 3/30/2007 20 5895
OP 0000000001 6/12/2008 25 5895 *need values from this row
OP 0000000001 4/30/2008 30 5895
OP 0000000001 9/11/1982 6 5895
OP 0000000001 5/30/2001 14 5895
OP 0000000001 8/4/2000 50 5895



Thanks

Bryan
   

- Advertisement -