title: SQL 0 if negative value
body: <p>So I want to turn negative value's into a 0. I found 2 solutions that do exactly the same:</p>
  
  <pre><code>SUM(IF(ordered_item.amount &lt; 0, 0, ordered_item.amount)) as purchases
  </code></pre>
  
  <p>And </p>
  
  <pre><code>SUM(CASE WHEN ordered_item.amount &lt; 0 THEN 0 ELSE ordered_item.amount END) as purchases
  </code></pre>
  
  <p>They give me both the same result, but which would give me the best <em>performance</em>? And is there maybe a <em>simpler</em> solution to turn negatives into <code>0</code>.</p>