I'm working on this report which is meant to return the last purchase date and last purchase quantity for a list of items.

my basic sql is as follows:

```
select im.ItemName, max(prh.Receiptdate), prl.ReceiptQuantity/*which corresponds with max ReceiptDate*/
from ItemMaster im
left join PurchaseReceiptLines prl on prl.ItemName = im.ItemName
left join PurchaseReceiptHeader prh on prh.ReceiptNum = prl.ReceiptNum
group by im.ItemName

```

Does anyone have any pointers?

Any help would be awesome