Thanks, I've got that working now:
var query = feeAllRecords
.GroupBy(f => new { f.AccountNo, f.FeeTypeID })
.Select(group => new { fee = group.Key, total = group.Sum(f => f.FeeAmount) });
At the moment I'm then looping through this result set to convert to my final result set:
List<inFee> feeRecords = new List<inFee>(feeAllRecords.Capacity);
foreach (var rec in query)
{
inFee fee2 = new inFee();
fee2.AccountNo = rec.fee.AccountNo;
fee2.FeeTypeID = rec.fee.FeeTypeID;
fee2.FeeAmount = rec.total;
feeRecords.Add(fee2);
}
It works, but it seems 'incorrect', or at least that there should be a more efficent method??