Group By Method

The group_by method is part of Query Builder method for grouping result set by running GROUP BY SQL command.

Basic Usage

Here is the basic usage group_by method from $db property on SENE_Model class.

$this->db->group_by(string $expression): $this->db


This method has 1 required one parameter.


The $expression value can be single column name or can be SQL Function that compatible with GROUP BY command.


Here is the source code implementation of group_by method in a model class.

class Blog_Model extends SENE_Model{
  var $tbl = 'blog';
  var $tbl_as = 'b';
  public function __construct(){
  public function countByCategory(){
    return $this->db->get();