【问题标题】:Codeigniter Active Record - Delete where not in arrayCodeigniter Active Record - 删除不在数组中的位置
【发布时间】:2014-04-01 14:34:24
【问题描述】:

我找到了这个 codeigniter 活动记录查询,我可以在其中删除数组中的项目

$this->db->delete('stack', array('id' => $id)) 

但是,我想删除不在数组中的项目。

这可能吗?

【问题讨论】:

  • 我没有机会测试它,但那行不通:$this->db->where_not_in('id', $ids); $this->db->delete('stack');
  • 完美...添加它作为答案,我会给你打勾!

标签: sql arrays codeigniter activerecord


【解决方案1】:

这应该可以解决问题:

$this->db->where_not_in('id', $ids);
$this->db->delete('stack'); 

【讨论】:

    猜你喜欢
    • 2012-11-22
    • 2012-06-16
    • 1970-01-01
    • 2015-01-04
    • 2012-02-03
    • 1970-01-01
    • 2011-07-10
    • 2014-12-24
    • 2015-06-24
    相关资源
    最近更新 更多