选择所有行,分组依据

While using Codeigniter 3, I'm trying to select all records from table "X" while trying to group them by column "Y" as shown below:

$this->db->select();
$this->db->from("X");
$this->db->where(array('is_active' => 1));
$this->db->group_by('Y');

However, this retrieves only one record for each group.... any help would be great! Thanks!

use $this->db->get()->result_array() and assign it to a variable.

Use the following pattern :

    $this->db->select('*');
    $this->db->from('X');
    $this->db->where('is_active', 1);
    $this->db->group_by('Y');
    $query_result = $this->db->get();
    $result = $query_result->result();
    return $result;