I want to implement an array from the received data that will contain objects with the same identifiers.
pool.query('SELECT * FROM columnslist INNER JOIN tableslist ON columnKey = keyTable', (error, result) => {
response.send(result);
});
After executing this code, I get the expected result:
[
{
"id": 1,
"columnOne": "qeqeqq qq wq qw wwqqwdqd",
"columnTwo": "qdqdqdq wdqdqwqwd",
"columnThree": "dqwdq qw qqsvds",
"columnFour": "svsdvsxcvscsv svd ds",
"columnFive": "sdvsdvsdvs ds sdd",
"columnKey": 1,
"keyTable": 1,
"name": "Test"
},
{
"id": 3,
"columnOne": "qdqwdwq",
"columnTwo": "dqdqd",
"columnThree": "qdqdwq",
"columnFour": "wdqwdqwq",
"columnFive": "wdqdqw",
"columnKey": 2,
"keyTable": 2,
"name": "Qqeqeqeq"
},
{
"id": 4,
"columnOne": "qdqwdwq",
"columnTwo": "dqdqd",
"columnThree": "qdqdwq",
"columnFour": "wdqwdqwq",
"columnFive": "wdqdqw",
"columnKey": 2,
"keyTable": 2,
"name": "Qqeqeqeq"
}
]
Tell me how you can implement or process the response to get this result? I need an array to be created in the array, as I wrote earlier, with the same identifiers:
[
[{"keyTable": 1,"name": "Test"...}],
[{"columnKey": 2,"keyTable": 2...}, [{"columnKey": 2,"keyTable": 2...}]
]
Thanks to!