【发布时间】:2017-11-20 11:48:54
【问题描述】:
我需要进行一个查询,该查询能够从我的表中删除多行。为了做到这一点,我在数组中创建了一个数组,其中包含需要传递给该查询的值。这是我的代码:
var deleteRooms = [ [ 3, 23 ], [ 4, 23 ], [ 5, 23 ], [ 2, 23 ]];
connection.query("DELETE FROM rate_plans_rooms WHERE room_id = ? AND rate_plan_id = ? ",
[deleteRooms],function(err,results){
if(err){return console.log(err)}
else
{
console.log('sended');
}
});
但每次我收到这样的错误:
{ Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check
the manual that corresponds to your MariaDB server version for the
right syntax to use near ' (4, 23), (5, 23), (2, 23) AND rate_plan_id
= ?' at line 1
我该如何解决这个问题并正确发送我的查询?
【问题讨论】: