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

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -