Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

GROUP BY - Query language in Cosmos DB (in Azure and Fabric)

The GROUP BY clause collects rows that have the same values into summary rows.

Syntax

GROUP BY <expression>

Arguments

Description
expression The expression to group by.

Return types

Returns grouped rows based on the specified expression.

Examples

This section contains examples of how to use this query language construct.

Group by a property

In this example, the GROUP BY clause is used to group employees by their software development language.

SELECT 
 e.capabilities.softwareDevelopment AS developmentLang
FROM
 employees e
WHERE
 e.team = "Cloud software engineering"
GROUP BY
 e.capabilities.softwareDevelopment
[
 {},
 {
 "developmentLang": "c-sharp"
 },
 {
 "developmentLang": "javascript"
 },
 {
 "developmentLang": "python"
 }
]

Feedback

Was this page helpful?

Additional resources