I want to insert a 2d array (if we consider it as a table) and it can have any number of rows but a fixed umber of defined columns so how do insert this into a mysql table
var myArr = [
[ 10000, '2021-03-08', 10000, '2021-03-07', 0, 364 ],
[ 10000, '2021-04-08', 10000,'2021-03-08', 0, 333 ],
[ 10000, '2021-05-08', 5000, '2021-03-08', 2500, 303 ]
]
sql = 'INSERT INTO vm001 (Amount, date, entryamt, entrydate, balanceamt, daysdel) VALUES ?'
db.query(sql , myArr , function (err) {
console.log(err)
})
this is what I tried but it didn't work so can anyone suggest a way to make this work this is the console
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10000, '2021-03-08', 10000, '2022-03-07', 0, 364' at line 1