title: Select with group by and count two columns
body: <p>I have this table</p>
  
  <pre><code>+----+----------------------------+---------------+----------+
  | ID |         CREATED_AT         |   CATEGORY    |   TYPE   |
  +----+----------------------------+---------------+----------+
  |  1 | 2017-11-23 23:00:40.221958 | SEM COBERTURA | callback |
  |  2 | 2017-11-23 22:58:36.970052 | VENDA         | ativo    |
  |  3 | 2017-11-23 22:47:03.956185 | SEM COBERTURA | ativo    |
  |  4 | 2017-11-23 22:42:24.309915 | VENDA         | ativo    |
  |  5 | 2017-11-23 22:32:48.780418 | SEM COBERTURA | callback |
  |  6 | 2017-11-23 22:12:21.631433 | VENDA         | callback |
  |  7 | 2017-11-23 22:09:38.52699  | SEM COBERTURA | ativo    |
  |  8 | 2017-11-23 22:08:09.836343 | LIGACAO MUDA  | callback |
  |  9 | 2017-11-23 22:08:07.058063 | SEM COBERTURA | callback |
  | 10 | 2017-11-23 22:07:02.067439 | LIGACAO MUDA  | other    |
  +----+----------------------------+---------------+----------+
  </code></pre>
  
  <p>With the table above, i want group by and sum the column TYPE and sum the CATEGORY "VENDA", eg:</p>
  
  <p>This is what i want</p>
  
  <pre><code>+----------+------------+----------------+
  |   TYPE   | COUNT_TYPE | COUNT_CATEGORY_VENDA |
  +----------+------------+----------------+
  | callback |          5 |              1 |
  | ativo    |          4 |              2 |
  | other    |          1 |              0 |
  +----------+------------+----------------+
  </code></pre>
  
  <p>The type "callback" appear 5 times and has 1 category "VENDA", "ativo" appear 4 times and has 2 "VENDA"...</p>
  
  <p>To get TYPE and COUNT_TYPE i'm using this query: </p>
  
  <pre><code>SELECT TYPE, count(TYPE) AS COUNT_TYPE FROM table WHERE created_at BETWEEN '2017-11-23 00:00:00' AND '2017-11-23 23:59:00' GROUP BY TYPE ORDER BY COUNT_TYPE DESC
  </code></pre>
  
  <p>Can anyone help me, please?</p>