[英]Multiple join and update codeigniter sql
I am trying to make a query on CodeIgniter model, but when i make a multiple join with update it doesn't work. 我正在尝试对CodeIgniter模型进行查询,但是当我使用update进行多次联接时,它不起作用。 I have more tables to join I cant move on with these 3 tables only. 我有更多表要加入,我只能继续使用这3个表。
$emp_datas = array(
'status' => 'test',
'ticket_type' => 'SB',
);
$this->db->join('ticket_requests_type', 'ticket_requests_type.ticket_type_number = ticket_requests.ticket_type')
->join('employee', 'employee.empe_id = ticket_requests.employee_involved')
->set($emp_datas)
->where('ticket_number', $ticket_no)
->update('ticket_requests_type','ticket_requests');
To make it clear... The UPDATE
clause can refer to a table alias specified in the FROM
clause. 为了清楚起见... UPDATE
子句可以引用FROM
子句中指定的表别名。
I am giving a Generic example here: 我在这里给出一个通用示例:
UPDATE A
SET foo = B.bar
FROM TableA A
JOIN TableB B
ON A.col1 = B.colx
WHERE ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.