title: MYSQL get count of each column where it equals a specific value
body: <p>I recently set up a MYSQL database connected to a form filled with checkboxes. If the checkbox was selected, it would insert into the associated column a value of '1'; otherwise, it would receive a value of '0'.</p>
  
  <p>I'd like to eventually look at aggregate data from this form, and was wondering if there was any way I could use MYSQL to get a number for each column which would be equal to the number of rows that had a value of '1'. </p>
  
  <p>I've tried variations of:</p>
  
  <pre><code>select count(*) from POLLDATA group by column_name
  </code></pre>
  
  <p>which was unsuccessful, and nothing else I can think of seems to make sense (admittedly, I'm not all too experienced in SQL).</p>
  
  <p>I'd really like to avoid:</p>
  
  <pre><code>select count(*) from POLLDATA where column_1='1'
  </code></pre>
  
  <p>for each column (there close to 100 of them).
  Is there any way to do this besides typing out a select count(*) statement for each column?</p>
  
  <p>EDIT: </p>
  
  <p>If it helps, the columns are 'artist1', 'artist2', ....'artist88', 'gender', 'age', 'city', 'state'. As I tried to explain below, I was hoping that I'd be able to do something like:</p>
  
  <pre><code>select sum(EACH_COLUMN) from POLLDATA where gender='Male', city='New York City';
  </code></pre>
  
  <p>(obviously EACH_COLUMN is bogus)</p>