title: SQL Sum If with Multiple Criteria
body: <p>I've got these tables:</p>
  <blockquote>
  <p>people(personID, name)</p>
  <p>expenses(personID, contract, labor, materials, travel, class)</p>
  </blockquote>
  <p>The &quot;class&quot; column of the expenses table can have 3 options, a, b, or c. The three classes are another breakdown of how labor + materials + travel are used. So basically, labor + materials + travel = a + b + c. I just realized that maybe this table should be designed differently...maybe labor, materials, and travel, should also be a row item instead of a column. But anyway...</p>
  <p>I would like to get this query:</p>
  <pre><code>PersonName, Contract, Labor, Materials, Travel, Total, A, B, C
  
  Where Total = Labor + Materials + Travel = A + B + C
  </code></pre>
  <p>Is this possible?</p>
  <p>EDIT:</p>
  <blockquote>
  <p>ID, Contract, Labor, Materials, Travel, Class</p>
  <p>1, Blockbuster, $10, $20, $30, 'A'</p>
  <p>1, Blockbuster, $0, $15, $5, 'B'</p>
  </blockquote>
  <p>I want to get this query at the end</p>
  <blockquote>
  <p>ID, Contract, Labor, Materials, Travel, Total, A, B</p>
  <p>1, Blockbuster, $10, $35, $35, $80, $60, $20</p>
  </blockquote>