<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
<script type="text/javascript">
var table1=[
{lineid:1,rate:6,sessions:2,ratio:3},
{lineid:5,rate:8,sessions:1,ratio:5},
{lineid:9,rate:4,sessions:2,ratio:2},
{lineid:2,rate:1,sessions:3,ratio:3},
{lineid:"99",rate:2,sessions:5,ratio:1},
{lineid:"a",rate:4,sessions:3,ratio:9},
{lineid:7,rate:5,sessions:7,ratio:3},
];
var table2=[
{lineid:9,rate:4,sessions:2,ratio:2},
{lineid:2,rate:1,sessions:3,ratio:3},
{lineid:"99",rate:2,sessions:5,ratio:1},
{lineid:"a",rate:4,sessions:3,ratio:9},
{lineid:1,rate:6,sessions:2,ratio:3},
{lineid:5,rate:8,sessions:1,ratio:5},
{lineid:7,rate:5,sessions:7,ratio:3}
];
var table3=[
{lineid:9,rate:4,sessions:2,ratio:2},
{lineid:2,rate:1,sessions:3,ratio:3},
{lineid:"99",rate:2,sessions:5,ratio:1},
{lineid:"a",rate:4,sessions:3,ratio:9},
{lineid:1,rate:6,sessions:2,ratio:3},
{lineid:5,rate:8,sessions:1,ratio:5},
{lineid:7,rate:5,sessions:7,ratio:3}
];
//根据lineid把table2合并到table1//
table2.forEach(function(o,d){
table1.forEach(function(t){
if(t.lineid == o.lineid){
t['rate_2'] = o['rate'];
}
})
});
table3.forEach(function(o,d){
table1.forEach(function(t){
if(t.lineid == o.lineid){
t['rate_3'] = o['rate'];
}
})
});
console.log(table1);
</script>
</html>