我正在按照此操作使用单个查询更新多个表,但这在我的情况下不起作用。
我的查询如下:
$this->db->set('tbl1.col1', $val1);
$this->db->where('tbl1.col2', $val2);
$this->db->where('tbl1.col3', $val3);
$this->db->set('tbl2.col1', $val1);
$this->db->where('tbl2.col2', $val2);
$this->db->where('tbl2.col3', $val3);
$this->db->update('table1 as tbl1, table2 as tbl2');
Run Code Online (Sandbox Code Playgroud)
我收到的错误是:
Table 'database.table1 as tbl1, table2' doesn't exist
Run Code Online (Sandbox Code Playgroud)
这可能不适用于新版本的 codeigniter。
我正在使用CI-3.1.6和PHP-5.6.12
有没有其他方法可以在 codeigniter3 中使用单个查询更新多个表?