0
**我如何才能使用CodeIgniter的活動記錄類在DATE數據類型列中選擇月份部分?我的查詢是什麼?如何僅使用CI活動記錄在DATE數據類型列中選擇月份部分?
我也很困惑我需要使用什麼,.. LIKE或WHERE子句?
這裏是我的模型代碼段。**
`$previousMonth = date('m', strtotime(date('Y-m')." -1 month"));
$where = "MONTH(post_created_at),$previousMonth";
$this->db->select('*');
$this->db->from('tbl_post');
$this->db->where($where);
$this->db->where('post_approve', 'Yes');
$this->db->where('post_deleted', 'No');
$query=$this->db->get();
$countvalue = $query->num_rows();
echo "print_r($countvalue,TRUE);`
這可能會幫助你,http://stackoverflow.com/a/12256151/1978142 http://stackoverflow.com/a/17968278/1978142 – user1978142