答案 0 :(得分:1)
尝试使用此代码:
$this->db->select('*');
$this->db->from('kotahena_customers');
$where = "date BETWEEN DATE_SUB(now(), INTERVAL 3 MONTH) and now()";
$this->db->where($where);
$results = $this->db->get()->result();
//echo $this->db->last_query();
了解更多:video
答案 1 :(得分:1)
我在这里给您一个简单的查询。
$this->db->where('date BETWEEN DATE_SUB(now(), INTERVAL 3 MONTH) AND now()');
$data = $this->db->get('kotahena_customers')->result();
希望它可以解决您的问题。
答案 2 :(得分:0)
尝试一下
$this->db->select("*");
$this->db->from("kotahena_customers");
$this->db->where("date BETWEEN DATE_SUB(NOW(), INTERVAL 3 MONTH) AND NOW()", NULL, FALSE);
愿这对您有帮助。
答案 3 :(得分:0)
尝试这个也许会对您有所帮助。
功能测试() {
$this->db->select('*');
$this->db->from('kotahena_customers');
$this->db->where('date BETWEEN DATE_SUB(now(), INTERVAL 3 MONTH) AND now()');
$query = $this->db->get();
return $query->result();
}