Home > DeveloperSection > Forums > SQL SERVER GROUP BY CLAUSE
Ankit Singh

Total Post:341

Posted on    November-06-2015 10:33 PM

 .NET SQL Server 

 1 Reply(s)
 400  View(s)
Rate this:
 i want to use group by clause in sqlserver how to write select query in sql. please help me.

aditya kumar Patel

Total Post:254

Posted on    November-06-2015 10:40 PM

The SQL Server (Transact-SQL) GROUP BY 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;

select count(CustomerID) as totrecord,CustomerID,CustomerName,Address,City,PostalCode,Country from


group by CustomerID,CustomerName,Address,City,PostalCode,Country

Don't want to miss updates? Please click the below button!

Follow MindStick