我有一个关联数组,例如:
array(3) {
[0]=>
array(2) {
["userId"]=>
string(1) "10"
["customerId"]=>
string(3) "1809"
}
[1]=>
array(2) {
["userId"]=>
string(1) "13"
["customerId"]=>
string(3) "1094"
}
[2]=>
array(2) {
["userId"]=>
string(1) "45"
["customerId"]=>
string(2) "210"
}
}
我正在尝试从数据库中删除这些行,但找不到要运行的正确 Codeigniter 查询。
生成的查询应该是这样的:
DELETE FROM table
WHERE (userId,customer_id) IN ( (10,1809),(10,1809),(45,210) )
如果我试试这个
$this->db->where_in( '(userId, customer_id)', array( array(10,1809), array(10,1809), array(45,210) ));
$this->db->delete('table');
die(var_dump($this->db->last_query()));
我明白了,这是不正确的,当然:
DELETE FROM `table`
WHERE (userId, customer_id) IN(Array, Array, Array)
慕码人2483693
撒科打诨