title: Doing sum's if certain conditions are true
body: <p>I am trying to build a query that does a sum if a certain parameter is 
  set. For example:</p>
  
  <pre><code>SELECT SUM(IF(&lt;condition&gt;,field,field)) AS total_value
  </code></pre>
  
  <p>...which is working correctly.</p>
  
  <p>But i have <strong>more than one condition in the IF()</strong>, like:</p>
  
  <pre><code>SELECT SUM(IF(&lt;condition&gt; &lt;condition&gt;,field,field)) AS total_value
  </code></pre>
  
  <p>..which is not working, could you have any idea what should be the right query for this.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Sorry for wrong queries, right queries are</p>
  
  <p>My current query looks something like this: 
  SELECT SUM(IF(condition1,field,field)) AS total_value
  which is working correctly.</p>
  
  <p>But i have more than one condition in IF(),like
  SELECT SUM(IF(condition1 condition2,field,field)) AS total_value
  which is not working, could you have any idea what should be the right query for this.</p>