My requirement was pretty simple, I needed to get the latest record based on the date and time. So I wrote this query to get the required record.
select firstonly SettleAmountCur from vendSettlement
order by CreatedDateTime desc
where vendSettlement.OffsetTransVoucher == vendTrans.Voucher
&& vendSettlement.TransCompany == vendTrans.DataAreaId
&& vendSettlement.AccountNum == vendTrans.AccountNum;
*This post is locked for comments