I need to insert multiple json value into a mysql column. Here I have a table named client
query = ' INSERT INTO client (user_id,client_id,tenant_id) values ?'
let queryClient = []
queryClient.push(clientData.user_id)
queryClient.push(clientData.client_id);
queryClient.push(clientData.tenant_id);
Before that I assigned req.body into clientData
Here is the connection to the mysql database
var queryMapClientIn = mysql.format(query, [queryClient])
const newMapClient = await conPool.query(queryMapClientIn, function (err, result) {
if (err) throw err;
console.log("Number of records inserted: " + result.affectedRows);
});
This is the code and json data is:
{
"user_id" : 101,
"client_id": 999,
"tenant_id" : 1,
"additionalClient" : [
{"user_id" : 130},
{"user_id" : 131}
]
}
Here is the json data and i need to push multiple user_id into user_id column on sql table. Can I get to know how to insert multiple user_id on this table.