Using GROUP BY
Select “column_name1″, “column_name2″,….”column_nameZ” FROM “table_name” Group by “Column_name” [asc|desc]
SELECT name, age FROM employee group by name, age
In the above example it displays all employees grouped by thier name and age.
Group by list should contain all columns in the Select List except ones which are used in Arthemitic functions like Sum.
SELECT store_name, SUM(Sales) FROM Store_Sales GROUP BY store_name