title: MySql Query Select sum and minimum record for 1 tables
body: <p>I have 1 table , i want  to query for specific column.
     Aa -> is distinct,</p>
  
  <p>Bb -> Sum B Total grouping by Aa,</p>
  
  <p>Cc -> Minimum value C for specific Aa,</p>
  
  <p>Bb1,Dd -> B,D value when C is minimum,</p>
  
  <p>Ee -> distinct </p>
  
  <h2>Table 1</h2>
  
  <pre><code>id | A | B | C | D | E |
  ------------------------
  1  | 2 | 1 | 2 | 1 | A |
  
  2  | 2 | 2 | 7 | 0 | A |
  
  3  | 4 | 1 | 7 | 3 | B |
  
  4  | 4 | 0 | 5 | 4 | B |
  </code></pre>
  
  <p>Result </p>
  
  <pre><code>Aa | Bb | Cc | Bb1 | Dd | Ee |
  -----------------------------
  2  | 3  | 2  | 1   | 1  | A  |
  
  4  | 1  | 5  | 0   | 4  | B  |
  </code></pre>
  
  <p>my query give wrong result</p>
  
  <pre><code>  SELECT
      test.A as Aa,
      SUM(test.B) as Bb,
      min(test.C) as Cc,
      test.D as Dd,
      test.E as Ee
      FROM `test` 
      group by A,E
  </code></pre>