public function groupBy($key, $tableName = null)
    {
        if (!$tableName) {
            $tableName = $this->getTableName();
        }
        $this->groupBy[] = ['key' => $key, 'tableName' => $tableName];
        return $this;
    }
public function groupBy($key, $tableName = null)
    {
        if (!$tableName) {
            $tableName = $this->getTableName();
        }
        $this->groupBy[] = ['key' => $key, 'tableName' => $tableName];
        return $this;
    }
public function groupBy ( $ key , $ tableName = null ) { if ( ! $ tableName ) { $ tableName = $ this -> getTableName ( ) ; } $ this -> groupBy [ ] = [ 'key' => $ key , 'tableName' => $ tableName ] ; return $ this ; }
Sets the group by for select queries.

@param string      $key
@param null|string $tableName

@return $this
Sets the group by for select queries .