Subject RE: [firebird-support] Latest entries on either Date or Batch No. field
Author Svein Erling Tysvær
Sorry, I didn't read the subject line, here's a modified query that excludes those that have later dDts or iBatchNos:

SELECT lPLFI.*,
mI.cDesc,
mI.cPack,
mI.cCode
FROM lPriceListsFixedItem lPLFI
LEFT JOIN mItems mI
ON lPLFI.iItemID = mI.iID
WHERE lPLFI.iPID = 69
AND NOT EXISTS(SELECT * FROM lPriceListsFixedItem lPLFI2
WHERE lPLFI.iItemID = lPLFI2.iItemID
AND (lPLFI.dDt < lPLFI2.dDt
OR lPLFI.iBatchNo < lPLFI2.iBatchNo)
ORDER BY lPLFI.iPID, mI.cDesc, mI.cPack, mI.cCode

HTH,
Set