---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps]
keyword: [Extend, Workday Query Language, WQL]
nav: wcp_docs
parent_url: /wcp_docs/
title: GROUP BY
layout: subsection
---

<a id="d91e263"></a>
Combines rows that have the same values into summary rows. Example: Group number of workers by location.

## <a id="d91e272"></a>Syntax

```
GROUP BY
  field1, field2, ...fieldN
```

## <a id="d91e281"></a>Arguments

<table><thead><tr><th><p>Argument</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><p><code><i>field1</i>, <i>field2</i>, ...<i>fieldN</i></code></p></td><td><p>The aliases for the fields by which you want to group results.</p></td></tr></tbody></table><br/>

## <a id="d91e332"></a>Example

Return the location and the maximum years of service for a worker at that location from the <b>allWorkers</b> data source:

```
SELECT location, max(yearsOfService) 
FROM allWorkers 
GROUP BY location
```

## <a id="d91e353"></a>Limitations

You can't group by:

-   Aggregated fields. Examples: `SUM(field1)`, `AVG(field1)`.
-   Currency fields.
-   Multi-instance fields.


