删除加入不工作 - Codeigniter

时间:2014-03-18 05:41:42

标签: php mysql codeigniter

我在codeigniter中有一个查询,例如

$this->db->join('mail_groups','subscriber.mail_group_id=mail_groups.mail_group_id');
$this->db->where('mail_groups.user_id',$this->user_id);
$this->db->where('subscriber.email_address',$email);
$this->db->delete('subscriber');

我收到此错误

enter image description here

表格结构

订户

enter image description here

邮件组

enter image description here

可以在Codeigniter中使用join进行删除吗?

1 个答案:

答案 0 :(得分:0)

试试这段代码。

$this->db->where(array("mail_groups.user_id"=>$this->user_id,"subscriber.email_address"=>$email))
           ->join("mail_groups", 'subscriber.mail_group_id=mail_groups.mail_group_id')
           ->delete("subscriber");