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


i have list of cities , counties in mysql each represent unique datapoint. want run query count how many times each different county appears. example:

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

should result in:

county        count fairfax          3 loudon           2 prince william   1 

select county, count(county) count table group county;  

Comments

Popular posts from this blog

Upgrade php version of xampp not success -

amazon web services - S3 and apache mod_proxy with basic authentication -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -