title: COUNT or SUM of fields in MySql
body: <p>I have a table in my database which save up to 60 fields with a yes or a no. I am wanting to COUNT or get the SUM off all fields from the table WHERE any of the fields equal to 'yes';</p>
  
  <p>I have tried the following but no luck:</p>
  
  <pre><code>SELECT count(*) FROM information_schema.columns WHERE table_name = 'portraits';
  </code></pre>
  
  <p>This will return the column count but doesn't allow me to count the fields where they equal to 'yes'. </p>
  
  <p>I am wondering is this easier to do in php? I am currently doing this in codeigniter and I don't know how to read the key/value as it is an object. Any ideas?</p>