# phpDox - Query\QueryBuilder::groupBy

# Query\QueryBuilder::groupBy

#### Group the results by the selected field(s)

## Signature

`public function groupBy(mixed $field )`

## Parameters

`$field` — mixed

## Returns

QueryBuilder

## Defined by Interface

`QueryBuilderInterface`

## Violations

### PHPMessDetector

Line | Rule | Message
--- | --- | ---
454 - 456 | ElseExpression | The method groupBy uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.