这是我的表结构。我想在提供的日期范围内获取记录。
|--------------|---------------------|
| id | year | month |
|--------------|---------------------|
| 1 | 2015 | 01 |
| 2 | 2015 | 02 |
| 3 | 2016 | 02 |
|--------------|---------------------|
我尝试了以下查询,但没有成功。
return $this->db->select('*')
->from('tourist T')
->where('T.year >=', $where['s_year'])
->where('T.month >=', $where['s_month'])
->where('T.year <=', $where['e_year'])
->where('T.month <=', $where['e_month'])
->get()->result();
最佳答案
试试这个:
$this->db->select('*')
->from('test T')
->where('T.year >='.$where['s_year'].' and T.month >='.$where['s_month'])
->where('T.year <='.$where['s_year'].' and T.month <='.$where['s_month'])
->get()->result();
关于php - Codeigniter Active Record,多个 where 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37592430/