title: How to filter and count percentages and count in SQL
body: <p>After a query I end up with a table like this
     <code>tbl_1</code>:</p>
  
  <pre><code> category type   count
      cpg      b      1
      auto     c      1
      cpg      c      1
      auto     v      1
  </code></pre>
  
  <p>I would like to calculate the total_count by <code>category</code>, and the percentage of count that <strong>is not</strong> (<code>type&lt;&gt;'v'</code>) also by category in SQL.</p>
  
  <p>Any ideas how I could do that ? </p>
  
  <p>The resulting table should look like this:</p>
  
  <pre><code>category total_count percentage
  cpg          2         1
  auto         2         0.5
  </code></pre>