Mengapa tidak menghitung seluruh catatan saja?
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;
}
Meskipun saya tidak mengerti klausa group_by Anda...