24 May 2011

SQL GROUP BY Statement

SQL 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.

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

GROUP BY More Than One Column

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

No comments:

Post a Comment

Comments Welcome