Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

left join in javascript

You need a first lookup for the values that exist in table1, so make a map using an object:

var maps = {};
for (var i = 0; i < table1.length; i++) {
  maps[table1[i].attr4] = 1;
}

Then you can loop throught the items in table2 and filter them:

var result = [];
for (i = 0; i < table2.length; i++) {
  if (!(table2[i].attr3 in map)) {
    result.push(table2[i]);
  }
}
 
PREVIOUS NEXT
Tagged: #left #join #javascript
ADD COMMENT
Topic
Name
9+9 =