title: group by year and boolean column postgres
body: <p>I have the following table</p>
  <pre><code>id   |  created_on   | is_a   | is_b    | is_c
  ----------------------------------------------
  1    |  01-02-1999   | True   |False    |False
  2    |  23-05-1999   | False  |True     |False
  3    |  25-08-2000   | False  |True     |False
  4    |  30-07-2000   | False  |False    |True
  5    |  05-09-2001   | False  |False    |True
  6    |  05-09-2001   | False  |True     |False
  7    |  05-09-2001   | True   |False    |False
  8    |  05-09-2001   | True   |False    |False
  </code></pre>
  <p>In the table resulting the query, I would like to group by year of creation, and then be able to compare how many records were created in each year for <code>is_a</code> and <code>is_b</code>. I want to completely ignore from the count <code>is_c</code>.</p>
  <pre><code>count_a | count_b  | by_creation_year
  -----------------------------------------------
  1       |1         | 1999
  0       |1         | 2000
  2       |1         | 2001
  </code></pre>
  <p>I tried the following query:</p>
  <pre><code>select count(is_a = True) a, 
         count(is_b = True) b,
         date_trunc('year', created_on)
  from cp_all
  where is_c = False  -- this removes the records where is_c is True
  group by date_trunc('year', created_on)
  order by date_trunc('year', created_on) asc;
  </code></pre>
  <p>But I get a table where the count of a and b is exactly the same.</p>