我连续有2个查询,例如:
"SELECT A.id , A.name FROM A WHERE 1"
"SELECT b.val1, b.val2 FROM B WHERE B.id = result_from_A"
结果ID存储在数组中
var JSON_obj = JSON.parse(JSON.stringify(results_A));
for (let i = 0; i < JSON_obj.length; i++) {
var A_Id = parseInt(JSON_obj[i].id);
//query B from A_Id
}
以及如何使数据看起来像这样
[{"name" : "...",
"data":[
{"val1":...},
{"val2":...}]
},
{"name" : "...",
"data":[
{"val1":...},
{"val2":...}]
}]