---
title: "SQL SERVER GROUP BY CLAUSE"  
description: "SQL SERVER GROUP BY CLAUSE"  
author: "Anonymous User"  
published: 2015-11-06  
updated: 2015-11-06  
canonical: https://www.mindstick.com/forum/33576/sql-server-group-by-clause  
category: ".net"  
tags: ["sql server"]  
reading_time: 1 minute  

---

# SQL SERVER GROUP BY CLAUSE

i want to use [group by clause](https://www.mindstick.com/forum/262/group-by-clause) in [sqlserver](https://www.mindstick.com/forum/33737/between-condition-in-sqlserver) how to write [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) [query in sql](https://www.mindstick.com/forum/160921/help-with-writing-a-recursive-query-in-sql-server). please help me.

## Replies

### Reply by Anonymous User

The SQL Server (Transact-SQL) [GROUP](https://yourviews.mindstick.com/view/81323/adani-green-energy-group-bags-world-s-biggest-solar-bid) BY [clause](https://www.mindstick.com/forum/33937/difference-between-throw-exception-and-throw-clause) is used in a SELECT statement to collect data across multiple records and group the results by one or more columns.The syntax for the GROUP BY clause in SQL Server (Transact-SQL) is:

```
SELECT expression1, expression2, ... expression_n,
aggregate_function (expression) FROM tables WHERE conditions GROUP BY
expression1, expression2, ... expression_n;
```

```
Example:
select count(CustomerID) as totrecord,CustomerID,CustomerName,Address,City,PostalCode,Country from Customer
group by CustomerID,CustomerName,Address,City,PostalCode,Country
```

```

```


---

Original Source: https://www.mindstick.com/forum/33576/sql-server-group-by-clause

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
