title: How to return distinct values and their count?
body: <p>What I'm trying to do is (hopefully) simple, but I just don't quite have the right syntax. I'd like to return all distinct values in a table with a count of how many records for each value.</p>
  
  <p>So, in PHP, I've got:</p>
  
  <pre><code>$result = mysql_query("SELECT DISTINCT tagName FROM tagTable");
  while($row = mysql_fetch_array($result)){
      echo("&lt;p&gt;" . $row['tagName']) . "&lt;/p&gt;");
  }
  </code></pre>
  
  <p>This works well. The distinct values are returned! But now how do I get each distinct value's count to display as well? I would want something to the effect of:</p>
  
  <pre><code>echo("&lt;p&gt;" . $row['tagName']) . $tagCountGoesHere . "&lt;/p&gt;");
  </code></pre>