title: With MySQL, how to count members who are in an option and not in an other one?
body: <p>I would like to display some datas of a member table.</p>
  
  <p>My table looks like this (extract of the table structure):</p>
  
  <pre><code>id_member | city_member | option1  | no option 2
  -----------------------------------------------
     1      |   Paris     |    1     |    0
  . . . . . . . . . . . . . . . . . . . . . . . .
     2      |   Berlin    |    1     |    0
  . . . . . . . . . . . . . . . . . . . . . . . .
     3      |   Berlin    |    0     |    1
  </code></pre>
  
  <p>Here an example of the expected result (after a sql query):</p>
  
  <pre><code>city_member | members | option1  | non_option2
  -----------------------------------------------
     Paris    |   200   |    150   |   47
  . . . . . . . . . . . . . . . . . . . . . . . .
     London   |   325   |    286   |   189
  . . . . . . . . . . . . . . . . . . . . . . . .
     Berlin   |   124   |    110   |   12
  </code></pre>
  
  <p>Explanation: There is 200 members living in Paris. Among them, 150 have chosen the option 1. Among members who have chosen option 1 and who live in Paris, 47 of them don't have chosen option 2.</p>
  
  <p>I tried this query but it only works for the first three columns. I need help to find how to do for the fourth one.</p>
  
  <pre><code>SELECT city_member, 
      COUNT(id_member) AS members, 
      SUM(option1) AS option1, 
      SUM(option1 - option2) AS non_option2
  FROM my_table
  GROUP by city_member
  </code></pre>
  
  <p>How to do something like "COUNT member WHERE option2 = '0' AND WHO ARE IN option1 AS non_option2"?</p>