SQL Group By Query Function in CodeIgniter Framework – group_by()

You can use GROUP BY function with SELECT statement in CodeIgniter. When you use the GROUP BY function it will divide similar data into classes.

You can use a GROUP BY clause in CodeIgniter framework like on the below.

$this->db->group_by("start_date");
// GROUP BY start_date

You can create a statement that has multiple values such as below.

$this->db->group_by(array("start_date", "end_date"));
// GROUP BY start_date, end_date