title: SQL Order By Count
body: <p>If I have a table and data like this:</p>
  
  <pre><code>ID |  Name  |  Group   
  
  1    Apple     A    
  
  2    Boy       A
  
  3    Cat       B
  
  4    Dog       C
  
  5    Elep      C
  
  6    Fish      C
  </code></pre>
  
  <p>and I wish to order it according to the total of Group from smallest to largest value, such as :
  A - 2 records , B - 1 record , C - 3 records , so it will become:</p>
  
  <pre><code>3    Cat       B
  
  1    Apple     A    
  
  2    Boy       A
  
  4    Dog       C
  
  5    Elep      C
  
  6    Fish      C
  </code></pre>
  
  <p>I tried    </p>
  
  <pre><code>    $sql = "SELECT ID,Name FROM table ORDER BY COUNT(Group)";
  </code></pre>
  
  <p>but it just returns one result for me.</p>
  
  <p>Are there any hints? Thank you.</p>