$("#table tr").each(function() { //iterates through each row in a table
var name = $(this).find("input:eq(1)").val(); //value of second inputfield (namefield)
var amount = $(this).find("input:eq(2)").val();//value of third input field (amountfield)
//code to sum amounts for all rows where inputfield 2 is the same
});
// code where each sum amount is written to an existing sum field in a separate table that has the id of inputfield 2 (the name)