title: mysql order by SUM(column) group'd by another column
body: <p>i have the following database table: </p>
  
  <pre><code>create table table1 (
  col1 VARCHAR(5) NOT NULL,
  col2 VARCHAR(5) NOT NULL,
  col3 TINYINT NOT NULL,
  col4 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
  
  INSERT INTO table1 VALUES
  ('b','c',1,NULL),
  ('b','d',2,NULL),
  ('a','e',1,NULL),
  ('a','f',3,NULL); 
  
  mysql&gt; select * from table1;
  +------+------+------+------+
  | col1 | col2 | col3 | col4 |
  +------+------+------+------+
  | b    | c    |    1 |    1 |
  | b    | d    |    2 |    2 |
  | a    | e    |    1 |    3 |
  | a    | f    |    3 |    4 |
  +------+------+------+------+
  4 rows in set (0.00 sec)
  </code></pre>
  
  <p>i want to create a query that orders rows by SUM(col3) GROUP'd on col1.
  i then need to ORDER col3 DESC.</p>
  
  <pre><code>So final table will look like:
  +------+------+------+------+
  | col1 | col2 | col3 | col4 |
  +------+------+------+------+
  | a    | f    |    3 |    4 |
  | a    | e    |    1 |    3 |
  | b    | d    |    2 |    2 |
  | b    | c    |    1 |    1 |
  +------+------+------+------+
  
  i can get the SUM(col1):
  mysql&gt; select sum(col3) from table1 group by col1;
  +-----------+
  | sum(col3) |
  +-----------+
  |         4 |
  |         3 |
  +-----------+
  </code></pre>
  
  <p>but not sure how to proceed. Any help appreciated.</p>