📜  mysql 计数分组行 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:25.310000             🧑  作者: Mango

代码示例1
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
);