You can use group by statement .
The GROUP BY clause is used in conjunction with a collection of functions to group the result of one or more columns.
For example:
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
Here you can see the full example here .
eKek0 source
share