MySql ‘GROUP BY’ Statement

The GROUP BY Statement

The GROUP BY statement is Used in conjunction with the aggregate functions to 

group The result-set by one or more Columns.

SYNTAX:

SELECT column_name, aggregate e_function(column_ name) FROM table 

name WHERE column_ name operator value GROUP BY column_name

EXAMPLE:

SELECT Customer, SUM(OrderPrice) FROM Orders GROUP BY Customer

SQL GROUP BY STATEMENT

RESULT:

Customer     SUM(OrderPrice)

Johnson        2900

Brown   1800

Taylor.           2500

Leave a Reply

Your email address will not be published. Required fields are marked *