MySQL Count dikelompokkan

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
);
VasteMonde