如何查询以下内容: 表命名标签:列名为:Job_Number,数量
Job_Number | Qty
-------------------------
10 | 1
12 | 2
12 | 2
10 | 3
11 | 22
12 | 1
10 | 5
12 | 4
我的结果看起来像
Job_Number | Total_Qty
-------------------------
10 | 9
11 | 22
12 | 9
答案 0 :(得分:0)
基本聚合......
myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
//Column 1
td_1 = tr[i].getElementsByTagName("td")[0];
//Column 2
td_2 = tr[i].getElementsByTagName("td")[1];
if (td_1 || td_2) {
if (td_1.innerHTML.toUpperCase().indexOf(filter) > -1 || td_2.innerHTML.toUpperCase().indexOf(filter)> -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}