title: Order and group in SQL
body: <p>I have a database as:</p>
  
  <pre><code>Serial no.  Name
  1            A
  1            B
  2            Aa
  2            Z
  3            D
  3            A
  3            C
  </code></pre>
  
  <p>and I want the result as</p>
  
  <pre><code>Serial no.  Name
  2            Aa
  2            Z
  1            A
  1            B
  3            D
  3            A
  3            C
  </code></pre>
  
  <p>I want each group (having same serial no.) to be sorted with other groups on the basis of the first name in the groups but inside the groups the order of name should remain unchanged.</p>
  
  <p>I have tried doing </p>
  
  <pre><code>Select * From tablename
  group by `Serial no.` 
  order by `Name`
  </code></pre>
  
  <p>but I am getting :</p>
  
  <pre><code>Serial no.  Name
  2            Aa
  1            A
  3            D
  </code></pre>