没办法,只能通过循环一次次更新;
var updateMysql = function(){ data = excel[0].data; for(var i=1; i<data.length; i++){ if(data[i][0]){ _a = []; _a[0] = Math.round(data[i][7]); _a[1] = data[i][2]; _obj.push(_a) } } connection.connect(); var modSql = 'UPDATE word SET frequency = ? WHERE id = ?'; // var modSqlParams = [[1, 1], [2, 2]]; _obj.forEach(function(item,index){ //改 connection.query(modSql,item,function (err, result) { if(err){ console.log('[UPDATE ERROR] - ',err.message); return; } }); }) connection.end(); }