The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.
Syntax:
SELECT column(n) FROM table_name
WHERE [ conditions ]
GROUP BY column(n)
ORDER BY column(n)
The GROUP BY clause must before ORDER BY clause if ORDER BY clause exist.