Hi Alan...
You can try this way you can use sub query to archive this ...
try this query
Select (t4.TransNum),
(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 in ( select max(t3.transnum) from oinm )
Hope solves
Regards
Kennedy