レコード全体を数えないのはなぜですか?
public function getBoxOpenings($boxes, $from_date, $to_date){
$query = $this->db->select('box_id, COUNT(*) AS Openings')
->from('mc_boxes_has_openings')
->where_in('box_id', $boxes)
->where('actiontime >=', $from_date)
->where('actiontime <=', $to_date)
->group_by('box_id')
->get();
$data = $query->result_array();
return $data;
}
group_by句がわかりませんが...