I am trying to execute this query from an active record script in CodeIgniter 4.
SELECT pres.db_pem, COUNT(*) AS Count FROM pres GROUP BY pres.db_pem;
I have try with
public function countall()
{
$this->prestasi->selectCount('*', 'cat_total');
$this->prestasi->select("db_pem");
$this->prestasi->groupBy('db_pem', 'ASC');
return $this->prestasi->get()->getRowArray();
}
but I am only getting one row like this:
array(2) {
["cat_total"]=> string(1) "2"
["db_pem"]=> string(1) "1"
}
I am expecting multiple rows in the result set.