价格范围过滤器。
EX:>(0 到 10 和 15 到 20 以及 60 到 100)
$this->db->where('sales' >= 0)
$this->db->where('sales' <= 10)
$this->db->where('sales' >= 15)
$this->db->where('sales' <= 20)
.....等等
最佳答案
我猜你问的是组函数
$this->db->group_start();
$this->db->where('sales >= ', 0);
$this->db->where('sales <=', 10);
$this->db->group_end();
$this->db->or_group_start();
$this->db->where('sales >=', 15);
$this->db->where('sales <=', 20);
$this->db->group_end();
会产生
(`sales` >= 0 and `sales` <= 10) or (`sales` >= 15 and `sales` <= 20)
关于php - 如何在 Codeginter 中使用 SQL BETWEEN 运算符在多个价格范围内选择数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54145164/