Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8635

Query to display only the last invoice for each ShipToCode from the OINV table

$
0
0

Good day all

 

I need to write a query that pulls ONLY the last invoice for each ShipToCode from each CardCode using the OINV table.

 

 

Any ideas on a query that I can write to do this.I have written something like this but get the aggregate function error for a few fields in the select statement. Please help on making this work

 

Select

          DocNum,         

          CardCode,

          ShipToCode,

           DocDate

From

          OINV

WHERE

          CardCode = [%0]

ORDER BY

          DocDate DESC

Group by

          ShipToCode

 

Many thanks and Regards

Nevashan


Viewing all articles
Browse latest Browse all 8635

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>