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

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

$
0
0

Hi Nevashan,

 

Please give this a try:

 

Select    MAX(t0.DocNum) AS LatestDocNum,        

          t0.CardCode,

          t0.ShipToCode,

          (select DocDate from OINV where DocNum = MAX(t0.DocNum))

From           OINV t0

WHERE           t0.CardCode = [%0]

Group by t0.CardCode,

          t0.ShipToCode

 

Regards,

Johan


Viewing all articles
Browse latest Browse all 2756

Trending Articles



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