The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.
In order to find that how many orders have been given by individual customers in the month of april 2010.
SELECT Customer,SUM(OrderPrice) as "Total Orders"
FROM Orders
where order_date between '2010-04-01 00:00:00' and '2010-04-3023:59:59'
GROUP BY Customer
Result:
Customer Total Orders
Ali 60
David 50
Muhammad Junaid 75
In order to find that how many orders have been given by individual customers in the month of april 2010.
SELECT Customer,SUM(OrderPrice) as "Total Orders"
FROM Orders
where order_date between '2010-04-01 00:00:00' and '2010-04-3023:59:59'
GROUP BY Customer
Result:
Customer Total Orders
Ali 60
David 50
Muhammad Junaid 75