SQL SERVER GROUP BY CLAUSE

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 504  View(s)
Ratings:
Rate this:
 i want to use group by clause in sqlserver how to write select query in sql. please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: SQL SERVER GROUP BY CLAUSE

    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;
    
    Example:
    

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

    Customer

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!