I am trying to do a batch of insert to mysql. I got this code to work without the inner select question. How do I do a bulk insert in mySQL using node.js But when i add the select i get "ER_PARSE_ERROR".
var arr = [[1, '123456789', '2000-01-01', 1],[2, '123456789', '2000-01-02', 1],[3, '123456789', '2000-01-03', 1]];
objConn.query("INSERT INTO stats (`name`, `phone`, `dayOfCall` , `calls`) \
VALUES ((SELECT `name` as myname FROM `contact` WHERE `id` = ? \
LIMIT 1), ?, ?, ?)",
[arr],
function (err, row, fields){
if(err)
logger.info(err);
}
);