mysql count group by code example
Example 1: mysql count grouped rows
SELECT DISTINCT my_field, COUNT(*) FROM my_table GROUP BY my_field;
-- Count of grouped rows:
SELECT COUNT(*) FROM (
SELECT DISTINCT my_field FROM my_table
);
Example 2: sql groub by count
SELECT COUNT(Id), Country
FROM Customer
GROUP BY Country