如何在 MYSQL 中使用 COUNT 和 DISTINCT 为每个不同的值创建单独的计数?

How can I use COUNT and DISTINCT in MYSQL to create a separate count for each distinct value?

我有一个 MYSQL 中的城市和县列表,每个城市和县代表一个唯一的数据点。我想要 运行 一个查询,该查询将计算每个不同县出现的次数。例如:

city            state       county
chantilly       virginia     fairfax
chantilly       virginia     fairfax
reston          virginia     fairfax
leesburg        virginia     loudon
ashburn         virginia     loudon
manassas        virginia     prince william 

应该导致:

county        count
fairfax          3
loudon           2
prince william   1
select county, count(county) as Count from table group by county;