Hi Alan Rossiter,
Do you want display the query for single item?
OR try this query
Select t4.TransNum,
max(t4.docdate) [Last Transaction Date],
t0.docnum, t0.cardname, t2.onhand [In stock], t1.itemcode, t1.Dscription,
t2.AvgPrice [Item Cost], (t2.onhand * t2.avgprice) [Total Cost]
from ORDR t0
left join rdr1 t1 on t0.docentry = t1.DocEntry
left join oitm t2 on t1.ItemCode = t2.itemcode
left join (select max(t3.transnum) [Transnum], t3.itemcode, t3.docdate from oinm t3 where t3.TransType = '20' Group by t3.transnum, t3.itemcode, t3.docdate) as t4 on t2.itemcode = t4.itemcode
where t1.ItemCode <> 'Transport' and t2.onhand > 0 and t4.transnum is not null
Group by t0.docnum, t0.cardname, t2.onhand, t1.itemcode, t1.Dscription, t2.AvgPrice , (t2.onhand * t2.avgprice),
(t4.docdate), t4.TransNum
Order by max(t4.docdate) desc
Note: You can get the result of 19-06-2.13 in above query
Thanks & Regards,
Nagarajan